Hi guys. Just this tiny prog I just did to calculate my pay for my job and for some reason the dialog just wont show up. Can anybody help?
Thanks
Hi guys. Just this tiny prog I just did to calculate my pay for my job and for some reason the dialog just wont show up. Can anybody help?
Thanks
The 2nd parameter of Dialogproc should be either a string identifier or a string placeholder generated with, for example, the MAKEINTRESOURCE macro. Either enclose the dialog id in quotes in the resource script or, arguably better, use MAKEINTRESOURCE on the short int id value.
You may have to set the WS_VISIBLE style for the dialog, but I think you might get away with it with this example.
I changed it to this but its still not appearingCode:DialogBox(hInstance, MAKEINTRESOURCE("DLG_MAIN"), NULL, APP_DlgProc);
if i understand what you're trying to do (didn't have time to download) take out the quotes from DLG_MAIN
Code:DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, APP_DlgProc);
The syntax provided by Leeman_s is one of the two ways I was referring to ie use MAKEINTRESOURCE on the short int id value.
For future reference, resources can be assigned a short int (WORD, 0-65535) id numeric value or a string identifier, not both. If a function, such as DialogBox, requires an 'LPCTSTR' type then you should, as I have previously mentioned, use either MAKEINTRESOURCE on the numeric id to convert it to the required type or just use the neat string identifier.
Sorry for not being clearer earlier.
took out the quotes, still not working. DLG_MAIN is the identifier. I even tried(DLG_MAIN is defined as 104)Code:BOOL b = DialogBox(hInstance, MAKEINTRESOURCE(104), NULL, APP_DlgProc);
Try setting the WS_VISIBLE style for the dialog. Also, make sure you remove the *.aps file prior to rebuilding. If it still fails after that, ditch the project and create a new one; sometimes msvc just acts like an arsehole, although i'm sure the pro's and more knowledgeable programmers of these board have a more descriptive technical term for that kind of intermittent behaviour.
Last edited by Ken Fitlike; 12-29-2002 at 04:28 AM.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
Since I was bored, here's one that worked for me on win9x/2k:
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
Sweet that worked. Thanks. What changes did you make? Just so I know in the future...what mistakes did I make?
Ok, I tried your program, (just added a couple of things that dont affect anything) and it for some reason crashes when you press 'Calculate' I debugged it and it exited with code 1 which I looked up using ErrorLookup utility and it said that error code 1 meant 'Incorrect Function'. Whats wrong?
>>What changes did you make?<<
Other than use MAKEINTRESOURCE on the dialog id, nothing. I did create an entirely new project as described above, so I suppose that the problem lay with that particular project and msvc.
So...do you know what the other problem is?
Here's the project
oops silly me. Had EndDialog() after Calcualte(). Its all good now.