-
GetDlgItemText
Im using this functiuon here:
UINT GetDlgItemText(HWND hDlg,
int nIDDlgItem,
LPTSTR lpString,
int nMaxCount
);
I have all the parameters apart from 'int nIDDlgItem'
I have no idea where or how to get this. I've looked at some example, I see alot of IDC_????
I tried to look these up to no avail.
Could someone tell how i woulg go about finding this value, or the function calls to use?
Thanks.
-
Use the MAKEINTRESOURCE macro... like
Code:
::GetDlgItemText(hDlg, MAKEINTRESOURCE(IDC_SOMETHING), Str, StrLen);
Where IDC_SOMETHING is the ID of the control you want to get text from
-
ok i saw a post down the list, it said you can use the resourse editor, this edit box i am trying to recieve text from is an another application.
so im not sure about how to do the equivilient, i used spy++ to see if i could see anything, i closest thing i found saw under cursor handle: IDC_SIZE which dosent work
-
Maybe you can just use WM_GETTEXT? You don't have to specify an identifier for that.
Also, you can retrieve the identifier using GetDlgCtrlID(). That should work.
-
ok, i eventually found it on MSDN, the function cant be called to retrieve text from other processes.
the solution in case anyone has the need: is to simple copy to the the windows clipboard as all processes have access to this function
-
or, as bennyandthejets pointed out, you can use GETTEXT. If you can get the HWND of the edit box in question (p'haps using EnumWindows and EnumChildWindows) you can simply use:
Code:
LPCTSTR buff[MINSIZE]
SendMessage(hEditWnd, WM_GETTEXT, MINSIZE, (LPARAM)buff);
its true you cant use GetDlgItemText or GetWindowText accross processes, but you can use WM_GETTEXT. Its cos the former two functions have some sort of security built in - I think it was to avoid people hacking passwords in password edit boxes, which you can still do with WM_GETTEXT!!