small ques about handles
-
dear all, how can i get the handles of controls present in my dialog. :confused: thanx
-
dear all, how can i get the handles of controls present in my dialog. :confused: thanx
hello, I don't know exactly what you want but: 1. if you are programming MFC and you need a CWnd pointer to an edit box(his resource id is for example IDC_EDIT1) or any other control in your dialog (dialog1) : dialog1.GetDlgItem(IDC_EDIT1); 2. in old windows programming style GetDlgItem(dialog1, IDC_EDIT1); where dialog1 is a handle to your dialog and IDC_EDIT1 is the resource id of the control for both functions the return value is what you want....
-
hello, I don't know exactly what you want but: 1. if you are programming MFC and you need a CWnd pointer to an edit box(his resource id is for example IDC_EDIT1) or any other control in your dialog (dialog1) : dialog1.GetDlgItem(IDC_EDIT1); 2. in old windows programming style GetDlgItem(dialog1, IDC_EDIT1); where dialog1 is a handle to your dialog and IDC_EDIT1 is the resource id of the control for both functions the return value is what you want....
thanx a lot _crs_ thats exactly what i was asking for, but how do i get the handle of dialog box (dialog1 in ur example)
-
thanx a lot _crs_ thats exactly what i was asking for, but how do i get the handle of dialog box (dialog1 in ur example)
Use CWnd::GetSafeHwnd() for any window.
-
thanx a lot _crs_ thats exactly what i was asking for, but how do i get the handle of dialog box (dialog1 in ur example)
... if you are in DialogProc - it looks like this LRESULT CALLBACK DialogPROC(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); handle to the dialog is "hDlg" your first parameter when you create a dialog ... DialogBox(hInst, (LPCTSTR)IDD_DIALOG1, hWnd, (DLGPROC)DialogPROC); where "hInst" is the application instance, "hWnd" is a handle to parent dialog window in your case will be main window "IDD_DIALOG1" is the dialog resource id and "DialogPROC" is the dialog callback procedure (like WndProc for your main window) if you use MFC look at the other answer ....