August 13th, 2003, 03:27 AM
Weird behavior IsDialogMessage
I have a program with a main window, what is in fact a modeless dialog. It is created without resources. It has an editbox, OK and Cancel button.
To get the standard keyboard interface like modal dialogs, I use the IsDialogMessage function in the messageloop.
The program works fine, except one case, by doing this four steps:
- Select the Cancel button by pressing TAB
- Deactivate the program
- Activate the program
- Enter the editbox
After the moment I select the Cancel button, this gets the default button, no problem. When I enter the editbox the Ok button gets the default button, but the Cancel button too. It doesn't lose its default border.
The attachment contains the code.
Thanks in advance!
August 13th, 2003, 03:29 AM
Maybe I should attach the file...
Here it is!
Last edited by BobKid; August 13th, 2003 at 04:10 AM.
August 19th, 2003, 04:54 AM
Have found the problem now, but it causes one new problem
In the WindowProc of the window I use the DefWindowProc(...) function.
This has to be the DefDlgProc(...) function and the class of the window has to be changed:
WindowClass.cbWndExtra = DLGWINDOWEXTRA;
The new problem is I can't close my program anymore, it doesn't respond on clicking on the close button.
I prefer a solution where I can still use DefWindowProc(...) I think, because I don't know if I can expect more problems like this when I use DefDlgProc(...) instead of DefWindowProc(...).
Is there anyone who can help me?