Were do get the handle for this function?
GetDlgItemText(
???, // handle of dialog box
IDC_EDIT1, // identifier of control
newname, // address of buffer for text
50 // maximum size of string
);
Thanks..
Were do get the handle for this function?
GetDlgItemText(
???, // handle of dialog box
IDC_EDIT1, // identifier of control
newname, // address of buffer for text
50 // maximum size of string
);
Thanks..
Hey,
You should have a function for your dialog, you should also have a handle in there like this:
Somthing like that anyway, you should adapt it for your program, as you can see the HWND param to the Dlg proc is a handle to your dialog, if you dont have a prodecure then you have phraphs created it wrong. You should call your dialog and specify it to a spefic prodecure like this:Code:BOOL Dialog(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { case WM_COMMAND: { switch(wParam) { case IDOK: { TCHAR szBuffer[60]; GetDlgItemText(hWnd, IDC_NUM1, szBuffer, strlen(buffer); MessageBox(hWnd, buffer, "Num1 Edit", MB_ICONOK); EndDialog(hWnd, 0); } return FALSE; }
Code:DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DLG), NULL, (DLGPROC)Dialog, 0);
There may be another way of doing this but thats how i do it and it works
Give it a go anyway,
TNT
Last edited by (TNT); 01-14-2002 at 03:05 PM.
TNT
You Can Stop Me, But You Cant Stop Us All
Erhmm...GetDlgItemText doesn't take a handle...it takes an ID. If you didn't use a resource script to make your dialog, use GetWindowText()
GetDlgItemText() does take a HANDLE (HWND) and an int resource ID.
If created on the fly (as opposed to in the resource editor) the HMENU param is cast as the control / dialog ID.
GetForegroundWindow() will return the HWND of the window / dialog that has focus (is being used).
For more look up "Window Functions" in MSDN SDK.
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill