For Win32 API gurus...

Started by
1 comment, last by Floru 23 years, 12 months ago
Hi! I have problem which no one has solved yet... I''m using Visual C++ 6 and I am programming in C. If I create a Edit Box with following flags: WS_CHILD / WS_VISIBLE / WS_HSCROLL / WS_VSCROLL / WS_BORDER / ES_LEFT / ES_MULTILINE / ES_READONLY / ES_AUTOHSCROLL / ES_AUTOVSCROLL How can I add text to my edit box through my program not by user (ES_READONLY)??? Is something wrong with my flags? I''ve managed to put something to edit box with sending a message of type WM_SETTEXT... The problem is that the text is not right and when I try to add some more text it always starts from the beginning... Please could someone help??? Thanks Floru
Advertisement
Look at the EM_* series of messages (those specific to edit controls.) For example EM_REPLACESEL will insert and replace text in the edit box at the given selection.

Tim
Try SetWindowText() with the HWND of the edit box. I don''t know the code to add something to it, but an easy fix would be 1) to get the old string (calling GetWindowText), 2) copy that string into a new buffer that is big enough for the old string plus the new string you want to add, 3) copy the new string in the buffer directly after the old one, and 4) call SetWindowText() with the buffer. If you are going to be adding things all the time, just create one array of the maximum size you''ll need and use that as the buffer each time instead of allocating a new one.



- null_pointer
Sabre Multimedia

This topic is closed to new replies.

Advertisement