- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
I am writing a simple windows application and in my main window message processing function I create a child window that is an edit box:
btn = ior(ior(WS_CHILD, WS_VISIBLE), ES_LEFT)
hEdt2 = CreateWindowEx(WS_EX_CLIENTEDGE, "Edit"C, ""C, btn, 101, 134, 100, 20, hWnd, 10, ghInstance, NULL)
This executes correctly and I get a child window that is an edit box control. Note that this child window resides in the client area of my main window; it is not part of a dialog box.
I enter text into this edit box and I want to read that text into a character variable. I tried the GetWindowText(hEdt2, ...) function and that returned an empty string. I tried SendMessage(hEdt2, WM_GETTEXT, ...) and SendMessage(hEdt2, EM_GETLINE, ...), and they also returned empty strings. How can I read the text from an edit box control that is not part of a dialog box?
Thanks!
- Marcas:
- Intel® Fortran Compiler
Link copiado
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Both method should work but remember if your string is gbuf you will probably need to pass loc(gbuf) in the LPTSTR for the Sendmessage
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
not 'probably' --
rval = SendControlMessage (hwnd, controlId, WM_GETTEXT, length, LOC(contents))
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
My bad - I forgot to declare the edit box handle with the "save" attribute. When I did, both GetWindowText and SendMessage (using loc function) worked correctly.
Thanks for your help.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Glad you fixed It Steven,
@Paul, LOL yes not "probably need", I think I meant "probably need to add because you maybe haven't already"

- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora