Win32 EM_GETLINE
I have never had to do much with win32 other than create a window for directX purposes, but i decided it was time to start learning how to do the GUI stuff (Visual C++).
I have a edit box (CreateWindow(...)) and i would like to get the text/String data from it.
I have been trying to use the SendMessage(hwnd, EM_GETLINE....
but i just don''t seem to understand how to wotk with it,
if anyone could help, it would be much appriciated,
Thanks.
I suppose you are implementing it like this:
It should work, but if it doesn''t then do this:
char char_array[1000]={0};int line_number=0;//...SendMessage(hEdit,EM_GETLINE,line_number,char_array);
It should work, but if it doesn''t then do this:
SendMessage(hEdit,WM_GETTEXT,num_characters,char_array);
Hmmm, sorry about that, I guess you would use a pointer to the buffer.
Ayway, just use this if you want to get the whole contents of the edit control: GetDlgItemText(hwnd,IDC_EDIT,char_array,1000);
Ayway, just use this if you want to get the whole contents of the edit control: GetDlgItemText(hwnd,IDC_EDIT,char_array,1000);
quote:Original post by Xiachunyi
char char_array[1000]={0};
int line_number=0;
//...
SendMessage(hEdit,EM_GETLINE,line_number,char_array);
That should be:
SendMessage(hEdit, EM_GETLINE, (WPARAM)line_number, (LPARAM)char_array);
Qui fut tout, et qui ne fut rien
Invader''s Realm
Hi,
Thanks Xiachunyi, thanks Invader X.
I must still be doing something wrong.
I create my text box with
...but i am still not getting the data from the edit box. Any further help would be much appriciated, thanks again.
PS. I have tried WM_GETTEXT, EM_GETLINE and the GetDlgItemText() method.
[edited by - Defcom on August 15, 2003 5:29:14 AM]
Thanks Xiachunyi, thanks Invader X.
I must still be doing something wrong.
I create my text box with
hwndtext = CreateWindowEx(NULL, "edit", "hello", WS_BORDER|WS_CHILD|WS_VISIBLE|ES_LEFT, 10,10, 100,100, hWnd, (HMENU)(100), hInstance, NULL); and then i 'Attempt' to get the data with //if pushbuttonif(LOWORD(wParam)==101){ char char_array[1000]={0}; int line_number=0; SendMessage(hwndtext, WM_GETTEXT, (WPARAM)line_number,(LPARAM)char_array); HDC hdc = GetDC(hwnd); TextOut(hdc,220,140,char_array,1000); }
...but i am still not getting the data from the edit box. Any further help would be much appriciated, thanks again.
PS. I have tried WM_GETTEXT, EM_GETLINE and the GetDlgItemText() method.
[edited by - Defcom on August 15, 2003 5:29:14 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement