flat assembler
Message board for the users of flat assembler.

Index > Windows > WM_GETTEXT

Author
Thread Post new topic Reply to topic
Hicel



Joined: 09 Sep 2004
Posts: 55
Hicel 20 Nov 2004, 01:23
Hi,
Does anybody know to get the text of a created edit box?
I have no idea how to do it i just tried with SendMessage and WM_GETTEXT but it didn't work!

Thanks for help!

Regards
Hicel
Post 20 Nov 2004, 01:23
View user's profile Send private message Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner 20 Nov 2004, 05:10
The DefWindowProc function copies the text associated with the window into the specified buffer and returns the number of characters copied. Note, for non-text static controls this gives you the text with which the control was originally created, that is, the ID number. However, it gives you the ID of the non-text static control as originally created. That is, if you subsequently used a STM_SETIMAGE to change it the original ID would still be returned.

For an edit control, the text to be copied is the content of the edit control. For a combo box, the text is the content of the edit control (or static-text) portion of the combo box. For a button, the text is the button name. For other windows, the text is the window title. To copy the text of an item in a list box, an application can use the LB_GETTEXT message.

When the WM_GETTEXT message is sent to a static control with the SS_ICON style, a handle to the icon will be returned in the first four bytes of the buffer pointed to by lParam. This is true only if the WM_SETTEXT message has been used to set the icon.

Rich Edit: If the text to be copied exceeds 64K, use either the EM_STREAMOUT or EM_GETSELTEXT message.

Windows 2000: Sending a WM_GETTEXT message to a non-text static control, such as a static bitmap or static icon control, does not return a string value. Instead, it returns zero. In addition, in previous versions of Windows and Windows NT, applications could send a WM_GETTEXT message to a non-text static control to retrieve the control's ID. To retrieve a control's ID in Windows 2000, applications can use GetWindowLong passing GWL_ID as the index value or GetWindowLongPtr using GWLP_ID.

copied from PSDK 2000 (July Edition)
Post 20 Nov 2004, 05:10
View user's profile Send private message Visit poster's website Reply with quote
mike.dld



Joined: 03 Oct 2003
Posts: 235
Location: Belarus, Minsk
mike.dld 20 Nov 2004, 10:46
Win32 Programmer's Reference wrote:
The GetWindowText function copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied.

Code:
int GetWindowText(
    HWND hWnd,          // handle of window or control with text
    LPTSTR lpString,        // address of buffer for text
    int nMaxCount      // maximum number of characters to copy
   );    
Post 20 Nov 2004, 10:46
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner 21 Nov 2004, 10:51
like subject

Image


Description:
Download
Filename: wm_gettext.txt
Filesize: 2.81 KB
Downloaded: 468 Time(s)

Post 21 Nov 2004, 10:51
View user's profile Send private message Visit poster's website Reply with quote
Hicel



Joined: 09 Sep 2004
Posts: 55
Hicel 21 Nov 2004, 14:25
Many Many Thanks to both of you!!
But what does 0xFE mean??
Post 21 Nov 2004, 14:25
View user's profile Send private message Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner 21 Nov 2004, 14:51
it just some reserved byte for the edit buffer
i guess you could change it to 0xFF
Post 21 Nov 2004, 14:51
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.