Click here to Skip to main content
15,893,161 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralUpdating Software (automatically) Pin
DanYELL4-Feb-04 9:54
DanYELL4-Feb-04 9:54 
Generalthe daily "WTF, my app. crashes" post ... Pin
Maximilien4-Feb-04 9:25
Maximilien4-Feb-04 9:25 
GeneralRe: the daily "WTF, my app. crashes" post ... Pin
Neville Franks4-Feb-04 10:04
Neville Franks4-Feb-04 10:04 
GeneralRe: the daily "WTF, my app. crashes" post ... Pin
Maximilien4-Feb-04 10:11
Maximilien4-Feb-04 10:11 
GeneralRe: the daily "WTF, my app. crashes" post ... Pin
Neville Franks4-Feb-04 10:16
Neville Franks4-Feb-04 10:16 
Generalautomatic setting a text in a text box using an API function("SetWindowText function isn't valid") Pin
Amr Abdel-Mohsen4-Feb-04 9:11
Amr Abdel-Mohsen4-Feb-04 9:11 
GeneralRe: automatic setting a text in a text box using an API function("SetWindowText function isn't valid") Pin
Nick Parker4-Feb-04 9:57
protectorNick Parker4-Feb-04 9:57 
GeneralRe: automatic setting a text in a text box using an API function("SetWindowText function isn't valid") Pin
Diddy4-Feb-04 23:22
Diddy4-Feb-04 23:22 
No.....

SetWindowText sets the text of _any_ window. Everything in Windows is a window, including simple controls. What the window does when it gets a WM_SETTEXT message varies between what it is.

A popup window (ie a normal window with a caption) sets it's caption
A button sets it's label
A edit control sets it's text

"This function changes the text of the specified window’s title bar, if it has one. If the specified window is a control, the text of the control is changed. For an edit control, the text is the contents of the edit control. For a combo box, the text is the contents of the edit-control portion of the combo box. For a button, the text is the button name. For other windows, the text is the window title."

Etc etc.

Assume when you say "textbox" you mean edit control. What may be causing you grief is the fact that the window handle belongs to another process and SetWindowText first validates the Window (if it's a control) to see if it belongs to the calling process.

Rather than use SetWindowText, do it manually with WM_SETTEXT

LPCTSTR pszTextToSet = "Hello";
::SendMessage(hWndTheControl, WM_SETTEXT, 0, (LPARAM)pszTextToSet);
GeneralRe: automatic setting a text in a text box using an API function("SetWindowText function isn't valid") Pin
Nick Parker5-Feb-04 2:37
protectorNick Parker5-Feb-04 2:37 
GeneralProblem with User Message Maps converting from VC6 to .net 2003 Pin
jhorstkamp4-Feb-04 8:06
jhorstkamp4-Feb-04 8:06 
GeneralRe: Problem with User Message Maps converting from VC6 to .net 2003 Pin
PJ Arends4-Feb-04 8:26
professionalPJ Arends4-Feb-04 8:26 
GeneralRe: Problem with User Message Maps converting from VC6 to .net 2003 Pin
jhorstkamp4-Feb-04 10:25
jhorstkamp4-Feb-04 10:25 
Generalconvert std::string to LPSTR or const char * Pin
_SaTaN_4-Feb-04 7:35
_SaTaN_4-Feb-04 7:35 
GeneralRe: convert std::string to LPSTR or const char * Pin
PJ Arends4-Feb-04 8:31
professionalPJ Arends4-Feb-04 8:31 
GeneralBooks Pin
Anonymous4-Feb-04 6:25
Anonymous4-Feb-04 6:25 
GeneralRe: Books Pin
Roger Wright4-Feb-04 6:58
professionalRoger Wright4-Feb-04 6:58 
GeneralRe: Books Pin
Maxwell Chen4-Feb-04 16:58
Maxwell Chen4-Feb-04 16:58 
GeneralRe: Books Pin
jhwurmbach4-Feb-04 23:52
jhwurmbach4-Feb-04 23:52 
GeneralRe: Multithreading in C++ Pin
TV4-Feb-04 4:48
TV4-Feb-04 4:48 
GeneralRe: Multithreading in C++ Pin
Diddy4-Feb-04 4:55
Diddy4-Feb-04 4:55 
Generaloralib linker errors Pin
JYoder4-Feb-04 4:48
JYoder4-Feb-04 4:48 
GeneralRe: oralib linker errors Pin
Mike Dimmick5-Feb-04 0:13
Mike Dimmick5-Feb-04 0:13 
GeneralA question about HWnd of IE and toolbar in IE Pin
bin89224-Feb-04 4:39
bin89224-Feb-04 4:39 
Generalwhich language will be the best to use for db Pin
pnpfriend4-Feb-04 4:35
pnpfriend4-Feb-04 4:35 
GeneralRe: which language will be the best to use for db Pin
Antti Keskinen4-Feb-04 13:23
Antti Keskinen4-Feb-04 13:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.