Advertisement

what is wrong with my dialogbox

Started by May 02, 2001 09:10 AM
2 comments, last by Jonppe 23 years, 9 months ago
I try show dialog box that I''ve made resource editor LPCTSTR ST=MAKEINTRESOURCE(dialog); int i=::DialogBox(hInst,ST,NULL,DLGPROC(DialogProc)); I have tried to searh all over VC++ help but I just can''t find the reason why that doesn''t work. I just got "stack overflow" error. It shouldn''t be any missing library I think... help would be appreciated. What it is that I''ve forgotten?
God saw all that he had made. Shit happens sometimes. --the sixth day.
Stack overflow usually means there is something obvious and easy that is wrong. Usually something is recursively calling itself (like the wndproc) till it eventually runs out of stack space. Make sure the dialog template doesn''t already have a ''string'' identifier (you only need MAKEINTRESOURCE if it has an integer identifier). You could also try giving the dialog a non-null owner window. My first choice would be to look at the dialog proc that you''ve defined (you did do that didn''t you?) I would certainly not call it DialogProc in any case. Call it like MyDialogProc or something and make sure you call the DefWindowProc at the bottom of it. That''s probably the culprit.

Hope that helps

Advertisement
No, make sure you DON''T call DefWindowProc at the and of DialogProc. I tested it and it locked up the program. Didn''t cause an error, but I had to ctrl+alt+delete it.
DefWindowProc is for normal windows, not dialog boxes.



-Deku-chan

DK Art (my site, which has little programming-related stuff on it, but you should go anyway^_^)
D''oh! Actually you are exactly correct. It says under the MSDN help page for DialogProc:

"Although the dialog box procedure is similar to a window procedure, it must not call the DefWindowProc function to process unwanted messages. Unwanted messages are processed internally by the dialog box window procedure."

Sorry it has been too long since I did dialog boxes without MFC

Good catch Deku!

This topic is closed to new replies.

Advertisement