![]() |
编辑框的问题:如何设置编辑框文本?
CWnd *trywnd=this->FindWindowEx(NULL,NULL,"#32770","try");
CWnd *edit=this->FindWindowEx(trywnd->m_hWnd,NULL,"Edit",""); if(edit->m_hWnd) { edit->SendMessage(WM_SETTEXT,0,(LPARAM)(LPCTSTR)("fanqing")); } 上面代码我测试过了成功. 但是使用 edit->setwindowtext没有成功.证明了楼上的一句话SetWindowText cannot change the text of a control in another application. |
回复: 编辑框的问题:如何设置编辑框文本?
MFC的SetWindowText应该和SDK的SetWindowText类似,请看SDK的SetWindowText:
The SetWindowText 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. (注意:--->) However, SetWindowText cannot change the text of a control in another application. |
所有的时间均为北京时间。 现在的时间是 09:12 AM. |