News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

DialogBox

Started by Tam, October 10, 2007, 02:51:13 AM

Previous topic - Next topic

Tam

In VB, We can show a modal dialogbox like this:
Private Sub Form_Click()
    Form2.Show vbModal
End Sub
then, we can't click Form1 any more until we close Form2.

Now, in SDK(just API), there are two window hwnds: hwnd1 and hwnd2, how can we do it?

sinsi

Light travels faster than sound, that's why some people seem bright until you hear them.

Tam

sinsi,
YES, I know DialogBoxParam, but I must pass "LPCTSTR lpTemplateName" AND "DLGPROC lpDialogFunc" to it . Now I only need to set 2 windows, their hwnd is hwnd1 AND hwnd2, how ?

Tedd

INT_PTR DialogBoxParam(     
    HINSTANCE hInstance,
    LPCTSTR lpTemplateName,
    HWND hWndParent,
    DLGPROC lpDialogFunc,
    LPARAM dwInitParam
);


hInstance is the hInstance/hModule of your application.
lpTemplateName is (a pointer to) the name of a DIALOG resource, not a window or window handle - it's the identifier of the dialog 'form', if you like.
hWndParent is the window handle of the dialog's parent (the one that will be disabled while this dialog is showing.)
lpDialogFunc is (a pointer to) the function to be called whenever a message needs to be handled for the dialog (essentially takes the place of all your 'on<Event>' subs.)
dwInitParam is some value you want to give to the dialog at initialisation - what it is and what it means is entirely up to you and how you handle it in the dialog function (when handling the WM_INITDIALOG message.)



(If this isn't helping, you need to explain your question more :wink)
No snowflake in an avalanche feels responsible.

hoverlees

like a messagebox has a parent?

Vortex

Hi hoverlees,

Yes, a message box can have an owner or not.

hoverlees

Thanks Vortex.
I guess that Tam want the hwnd1 to be the parent of the hwnd2,so that we can't access hwnd2 any more until we close hwnd1.(just like a message box which has a owner)
I also dont know to do it.SetParent function seems no effect. :'(