I am unable to get DialogBoxParam to work. The code currently is (although I have tried multiple permutations and combinations) DBName DWORD ID_FILE_DIALOGBOX ... .IF uMsg == WM_DESTROY invoke PostQuitMessage,NULL ; quit our application .ELSEIF uMsg == WM_PAINT invoke BeginPaint, hwnd, ADDR ps mov hdc, eax invoke GetClientRect, hwnd, ADDR rect invoke EndPaint, hwnd, ADDR ps .ELSEIF uMsg == WM_COMMAND mov eax, wParam .IF eax == ID_EXIT invoke DestroyWindow, hWnd .ELSEIF eax == ID_FILE_DIALOGBOX invoke DialogBoxParam,hInstance,ADDR DBName,hwnd,ADDR DlgProc,NULL with this in the .rc file IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 186, 95 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Dialog" FONT 8, "MS Sans Serif" BEGIN DEFPUSHBUTTON "OK",IDOK,68,40,50,14 END I get the error "The specified resource name can not be found in the image file" (although I can see it with a hex editor). Any suggestion about what I am doing wrong would be greatly appreciated and/or a pointer to the source of a working program. I can't find an example of using a standard dialog box in an assembly program on the web and the openfilename demo in the tutorials (which are invaluable) doesn't quite fit. Thanks for anyone's help.
Posted on 2001-02-13 19:55:00 by tchused
ID_FILE_DIALOGBOX is your menu/button/whatever command code, and not the ID of your dialog box. DBName DB 'IDD_DIALOG1',0 should work a lot better.
Posted on 2001-02-13 21:14:00 by tank
Thank you very much, but, unfortunately, I miscopied the first line. It actually is DBName DWORD IDD_DIALOG1 to go with invoke DialogBoxParam, hInstance,ADDR DBName,hwnd,ADDR DlgProc,NULL and in the .rc file IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 186, 95 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Dialog" FONT 8, "MS Sans Serif" BEGIN DEFPUSHBUTTON "OK",IDOK,68,40,50,14 END
Posted on 2001-02-13 22:39:00 by tchused
Oh, then if IDD_DIALOG1 is equated to a number, then you need to pass the number, not the address of the number.

    invoke DialogBoxParam, hInstance,DBName,hwnd,ADDR DlgProc,NULL
How does Win32 know whether it's being passed an ID or a string address? An ID is 16-bit, so it must be < 65536. No version of Windows will load code/data into that address space.
Posted on 2001-02-15 00:14:00 by tank
You need

.data
DBName db "IDD_DIALOG1",0
;     /|\     /|\
;      |       |
;NOT DWORD!  TEXT
...

.code

...

invoke DialogBoxParam,hInstance,ADDR DBName,hwnd,ADDR DlgProc,NULL
Mirno This message was edited by Mirno, on 2/15/2001 6:25:58 AM
Posted on 2001-02-15 06:24:00 by Mirno