When you are using a dialog as your main window, is it possible to set your window's class to something other than the default (#32770)? If so how can it be defined. Thanks for any input, as I am new to using dialogs. I have always created my own windows before.
Posted on 2003-02-24 23:51:28 by bubba
you do not need to call CreateWindowEx when using dialogbox as mainwindow. Just call DialogBoxParam from the entrypoint.
Posted on 2003-02-25 01:17:34 by roticv
Look at Iczelion's tutorial #10
Posted on 2003-02-25 02:05:34 by BubbaFate
Thank you guys, I just didn't know how to define this in my resource. I'm beginning to like the dialog method. :)
Posted on 2003-02-25 04:50:00 by bubba
I guess bubba means creating a modal dialog box with


int DialogBoxParam(

HINSTANCE hInstance, // handle of application instance
LPCTSTR lpTemplateName, // identifies dialog box template
HWND hWndParent, // handle of owner window
DLGPROC lpDialogFunc, // address of dialog box procedure
LPARAM dwInitParam // initialization value
);

If you want to retrieve the handle by API FindWindow you write


invoke FindWindow,SADD('#32770'),SADD('Dialogbox name')



HWND FindWindow(

LPCTSTR lpClassName, // address of class name
LPCTSTR lpWindowName // address of window name
);


I don't know how to change #32770 to someting else, but I am anxious to know.
Regards
Posted on 2003-02-25 04:58:48 by minor28
Yes, that's according to Iczelion's tutorial #10.

I presume from your answer that it is not possible to change the "#32770 " if I want to use "DialogBoxParam" instead of "CreateDialogParam".

Regards
Posted on 2003-02-25 06:25:22 by minor28
You must create a superclass of the dialog box class in order to change the classname, so there is no avoiding the wndclassex mess.

I have no way of trying this right now but have you tried just pluggin in DialogBoxParam instead of CreateDialogParam? Whats does it do when you do that?
Posted on 2003-02-25 09:17:56 by BubbaFate
My contribution to the issue only referes to bubba's thread. One reason to use "DialogBoxParam" instead of "CreateDialogParam" could be


.code
start:
invoke GetModuleHandle, NULL
mov hInstance,eax
invoke GetCommandLine
mov CommandLine,eax
invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT
invoke ExitProcess,eax

WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
LOCAL wc:WNDCLASSEX
LOCAL msg:MSG
LOCAL hDlg:HWND
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,NULL,IDI_APPLICATION
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

compared to


.code
start:
INVOKE GetModuleHandle, NULL
mov hInstance,eax
INVOKE DialogBoxParam, hInstance, ADDR DlgName,NULL,addr DlgProc,NULL
INVOKE ExitProcess,eax

DlgProc PROC hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM

Look at Iczelion's tutorial #10 part 1 and part 2.
Regards
Posted on 2003-02-25 10:47:10 by minor28