Problem with EM_GETSELTEXT

Hello Cplusplus

I have a problem with the parameter EM_GETSELTEXT in relation to my richedit box. I get no errors but the char array is empty, when I try to display it in the messagebox.
I hope you guys can help me! :)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
char getSelText[500];

case WM_CREATE:

HWND hEdit;
					
hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, RICHEDIT_CLASS, "", 
WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_NOHIDESEL, 
0, 0, 100, 100, hwnd, (HMENU)IDC_CHILD_EDIT, GetModuleHandle(NULL), NULL);

SendMessage(hEdit, EM_GETSELTEXT, (WPARAM) 0, (LPARAM)getSelText);

case WM_COMMAND:

case ID_XX:
      MessageBox(hwnd, getSelText, "", MB_OK);


Thank you very much guys!
You have no selected text.
Well, I have tried to type something into my richbox and then select/highlight it but it still turns up empty.
Oh I solved it.
I just had to make the HWND hEdit variable global and then move the SendMessage down to my case ID_XX.

But kbw thank you for your suggestion! :)
Topic archived. No new replies allowed.