Hello everybody, I am a beginner in Windows programming.
I used the Wizard for "simple dialog based application" and it created a program with a dialog that has an OK button.
My problem is that I do not understand how to use controls that I add to the dialog.
For example, if I add a progress bar to the dialog, then how do I access it from WM_INITDIALOG to fill it to 50%?
Normally I should use SendMessage() to the progress bar's handle, but what is the handle?
In other words: how to get the handles for the controls added to the dialog, or is there another way to do things?
HWND GetDlgItem(
HWND hDlg, // handle to dialog box
int nIDDlgItem // control identifier
);
LRESULT SendDlgItemMessage(
HWND hDlg, // handle to dialog box
int nIDDlgItem, // control identifier
UINT Msg, // message to send
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
Have a look here (https://msdn.microsoft.com/en-us/library/windows/desktop/bb773169(v=vs.85).aspx)
BOOL WINAPI SetDlgItemText(HWND hDlg,int nIDDlgItem,LPCTSTR lpString);
UINT WINAPI GetDlgItemInt(HWND hDlg,int nIDDlgItem,BOOL *lpTranslated,BOOL bSigned);
int WINAPI GetDlgCtrlID(HWND hwndCtl);
BOOL WINAPI SetDlgItemInt(HWND hDlg,int nIDDlgItem,UINT uValue,BOOL bSigned);
Useful too
Thanks to both. 8)