Originally Posted by
nutzu2010
hDialog-handle for a dialog then How do you get the handle for a dialog?is his id number?
The dialog's handle is passed in the message loop for the dialog box...
Code:
INT_PTR CALLBACK DialogProc(
HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
So when ever the user changes something, a message is passed and you can hand your function the dialog handle...
Here's an example from some live code to give you the idea...
Code:
// message tosser
BOOL CALLBACK SetupTosser(HWND Dlg, UINT Msg, WPARAM Wparm, LPARAM Lparm)
{ switch (Msg)
{ case WM_INITDIALOG :
SendMessage(GetDlgItem(Dlg,4002),EM_LIMITTEXT,20,0);
ImportSettings(Dlg,Lparm);
return 1;
case WM_HELP :
ShowHelp(Dlg,L"setup");
return 1;
case WM_COMMAND: // buttons
switch (LOWORD(Wparm))
{ case 4001 :
if (HIWORD(Wparm) == EN_KILLFOCUS)
CheckRange(Dlg,4001,1000,60000);
return FALSE;
case 4003 :
if (HIWORD(Wparm) == EN_KILLFOCUS)
CheckRange(Dlg,4003,5,200);
return FALSE;
case 4004 :
if (HIWORD(Wparm) == EN_KILLFOCUS)
CheckRange(Dlg,4004,5,200);
return FALSE;
case 4005 :
if (HIWORD(Wparm) == EN_KILLFOCUS)
CheckRange(Dlg,4005,1,60);
return FALSE;
case 4006 :
if (HIWORD(Wparm) == EN_KILLFOCUS)
CheckRange(Dlg,4006,100,10000);
return FALSE;
case 4050 : // help
ShowHelp(Dlg,L"setup");
return 1;
case IDOK :
case 4051 : // OK
ExportSettings(Dlg);
return FALSE;
case IDCANCEL :
case 4052 : // Cancel
EndDialog(Dlg,0);
return FALSE; } }
return FALSE; }
Notice how the dialog's messageloop (SetupTosser() ) passes the various parts of the call to each individual function... including the dialog box handle; Dlg.
You really should visit the forger's tutorial I linked you to in a previous message... he explains it much better than I can.