几何尺寸与公差论坛

 找回密码
 注册
查看: 1929|回复: 1

编辑框的问题:如何设置编辑框文本?

[复制链接]
发表于 2007-6-2 12:50:03 | 显示全部楼层 |阅读模式
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.
 楼主| 发表于 2007-6-2 12:51:03 | 显示全部楼层

回复: 编辑框的问题:如何设置编辑框文本?

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.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-6-2 20:21 , Processed in 0.037433 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表