After the mid DLL form is combined with application. MessageBox, the control becomes invalid ???

Source: Internet
Author: User
After the mid DLL form is combined with application. MessageBox, the control becomes invalid ??? Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiAPI/html/delphi_20061114101124242.html
Several forms are encapsulated into DLL forms (MDI subforms ).
A major problem is found:
If table controls, such as DBGrid or dbgrideh, exist on the MDI subform and other errors occur when submitting data, and the MessageBox information box appears (whether it is displayed by the system or manually try... else t... displayed MessageBox), there will be problems, as shown in:
1. The table will be useless. That is, when the mouse is clicked, the system does not respond (just like adodataset. disabledcontrols is the same, but I found that I did not execute adodataset. disabledcontrols, and when dbnavigator is clicked, the records on the table can be moved, but the direction key or mouse table does not respond ).
2. enabled of DBGrid or dbgrideh itself is normal and available;
3. When the above error occurs, if you move the Focus Outside the table (such as various edits or buttons) and click the mouse on the table, the problem will be solved immediately.

Note:
If I manually use showmessage to display information in case of an error instead of application. MessageBox, no error will occur;

What should I do? I must use application. messageBox (that is, the message box with a graph in the upper left corner), because showmessage is sometimes under the form, so that users cannot click it, and sometimes I still need to use application. messageBox dialog with the user.

Use API: MessageBox

In addition, I found that if the DLL form is not encapsulated, no errors will occur/
My application. MessageBox is not an API?
In addition, my dialog box is sometimes used for non-forms (that is to say, sometimes it is used in a pure DLL, and it is also used in a pure unit. I write a message box as a UDF, And I am worried that it will be caused by handle)

Application. MessageBox this is the method in VCL.
I suggest you use API: MessageBox to try:

MessageBox (0, 'info', 'title', mb_ OK or mb_iconinformation );
This is similar.

Eldest Brother, I tried it just now and solved the problem for the moment, but ask the eldest brother to answer it in detail:
1. What is the essential difference between VCL and API? Why is that error occurring when I use application?
2. MessageBox (0 in 0 is used as the handle. What does it mean? I require that no message boxes appear after the active form (because I often seeProgramThis makes it difficult for the user to operate again)
3. I found the information online and some netizens wrote:
MessageBox (getactivewindow (),...)
It means to get the handle assigned by the activity community. Will it cause an error when activewindow is not found when the form is not used?
Thank you!

My problem is similar to yours. The concern is that when application. MessageBox () is called, the program will lose its activity status. Why ??? Follow

I also encountered this problem. At that time, my dialog box was written as a public function, and then the dialog box appeared and ran to the back of the form, so the dialog function Body added a handle parameter.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.