i cant get it to work. i dunno y.

im using masm v8.0 and radasm 2.0.1.7

in the dlgproc, i have my standard if and elseif statements

.if uMsg==WM_DESTROY
' code
.elseif uMSG==WM_INITDIALOG
'code
.else uMSG==other stuff
.endif
.etc.etc. u know wut i mean

any clue why i cant get wm_initdialog to work properly? it doesnt load anythin in there...for some reason... if i want to do code in wm_initdialog, i really can't, i just put it after i made the dialog, before the procs and before the show/update/msg loop cause i cant get it to worm under wm_initdialog ;x ;x ;x
Posted on 2003-04-12 22:49:45 by xkardisx
Is the case difference in uMSG and uMsg just a typo ? If you could post more of the dialog proc and how the dialog was created it would be helpful in determining the problem. Maybe the dialog is created as a window (ie you setup a class and defined a window proc) that would require that you process the WM_CREATE mesage instead.
Posted on 2003-04-12 23:14:54 by donkey
lol yeah its a typo, i sort of just typed that on the screen a few minutes ago. but in the real code, its the same ;] so thats not the problem
Posted on 2003-04-12 23:26:10 by xkardisx
Is it a dialog as window (i.e. you create your own class then set up a message loop), this type of dialog does not send a WM_INITDIALOG message. That would be my guess given the extremely limited information you have given, outside of that there is really nothing to offer until you post a little more code, just looking at the message names doesn't help much.
Posted on 2003-04-12 23:31:03 by donkey
naturally i cut off some of the unnecessary parts



.data
ClassName db "DFCRollerClass",0
MenuName db "MyMenu",0
DlgName db "MyDialog",0

.data?
hInstance HINSTANCE ?
hDlg HWND ?

.code
invoke GetModuleHandle, NULL
mov hInstance,eax
invoke WinMain, hInstance,NULL, SW_SHOWDEFAULTi
invoke ExitProcess,eax
WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdShow:DWORD
LOCAL wc:WNDCLASSEX
LOCAL msg:MSG
mov wc.cbSize,SIZEOF WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc, OFFSET WndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,DLGWINDOWEXTRA
push hInst
pop wc.hInstance
mov wc.hbrBackground,COLOR_BTNFACE+1
mov wc.lpszMenuName,OFFSET MenuName
mov wc.lpszClassName,OFFSET ClassName
invoke LoadIcon,hInstance,666
mov wc.hIcon,eax
mov wc.hIconSm,eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
invoke RegisterClassEx, addr wc
invoke CreateDialogParam,hInstance,ADDR DlgName,NULL,NULL,NULL
mov hDlg,eax
INVOKE ShowWindow, hDlg,SW_SHOWNORMAL
INVOKE UpdateWindow, hDlg
.WHILE TRUE
INVOKE GetMessage, ADDR msg,NULL,0,0
.BREAK .IF (!eax)
invoke IsDialogMessage, hDlg, ADDR msg
.if eax==FALSE
INVOKE TranslateMessage, ADDR msg
INVOKE DispatchMessage, ADDR msg
.endif
.ENDW
mov eax,msg.wParam
ret
WinMain endp
WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
.if uMsg==WM_DESTROY
invoke PostQuitMessage,NULL
.elseif uMsg==WM_INITDIALOG
'some code
.elseif uMsg==WM_SOME_MSG
.else
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.endif
xor eax,eax
ret
WndProc endp
end start
Posted on 2003-04-12 23:31:23 by xkardisx
There is no WM_INITDIALOG message generated in a dialog as window program which is what you have, use the WM_CREATE message instead. Which I have said by the way in each post :)
Posted on 2003-04-12 23:33:23 by donkey
alright, actually i had initially put my code in the WM_CREATE area, but saw people posting and using WM_INITDIALOG but couldnt ever get it to work for me ;p
Posted on 2003-04-12 23:35:23 by xkardisx
It only works when you have Windows create the dialog for you. You can use the default dialog class and Windows will set up a message dispatch loop for you then send the WM_INITDIALOG message when everything is ready. This is by far the easiest way to set up a dialog, dialog as window gives you a little more control and things like accelerator keys etc...
Posted on 2003-04-12 23:41:30 by donkey



invoke CreateDialogParam,hInstance,ADDR DlgName,NULL,NULL,NULL
If you are using CreateDialogParam, then you must supply the dialog proc in the invoke.

invoke CreateDialogParam,hInstance,ADDR DlgName,NULL,ADDR WndProc,NULL
Posted on 2003-04-14 05:57:55 by tenkey
not necessary, u can declare the proc in the wc struct



mov wc.cbSize,SIZEOF WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW
[b]mov wc.lpfnWndProc, OFFSET WndProc[/b]
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,DLGWINDOWEXTRA
push hInst
pop wc.hInstance
mov wc.hbrBackground,COLOR_BTNFACE+1
mov wc.lpszMenuName,OFFSET MenuName
mov wc.lpszClassName,OFFSET ClassName
invoke LoadIcon,hInstance,666
mov wc.hIcon,eax
mov wc.hIconSm,eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
invoke RegisterClassEx, addr wc
invoke CreateDialogParam,hInstance,ADDR DlgName,NULL,NULL,NULL
Posted on 2003-04-14 12:34:49 by xkardisx
xkardisx...
wndclass is not used for dialogs (internally they are, but you will not be specifying them) - thus you must specify the dlgproc to CreateDialog*

WM_INITDIALOG: init message for dialogs
WM_CREATE: init message for "raw" windows
Posted on 2003-04-14 12:37:44 by f0dder
Hi f0dder,

I think he was using a resource dialog as a window. i.e. set the class of the dialog resource to the application defined class then calling CreateDialogParam. This method allows you to use the WNDCLASS structure and also the WindowProc specified in that class.

Hi xkardisx,

Looks perfect to me :)
Posted on 2003-04-14 14:29:34 by donkey
hrm, queer way of doing stuff
:rolleyes:
Posted on 2003-04-14 15:36:59 by f0dder
Actually I use it quite a bit when I need accelerator keys. You can use a dialog editor to make the window while still having all the advantages of your own message loop. Pretty darn convenient when you think about it.
Posted on 2003-04-14 15:41:10 by donkey
this question are you ravel out?
can you gave me solution?
Posted on 2005-10-16 14:45:37 by gt2000