当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

 ·谁有仙剑3的cd-key,百分相赠.    »显示摘要«
    摘要: 谁有仙剑3的cd-key,百分相赠. 我买d版的仙剑3,序列号不能用. ......
 ·大侠们请指点xml的写入问题    »显示摘要«
    摘要: 以下是一个xml文件: display the modified xml... <?xml version="1.0"?> <!-- sample xml document --> <bookstore xmlns:bk="urn:samples"> <book genre="novel"......


一个sdi程序,如何在新开的一个线程中改变statusbar的内容

同上  
  请给出::AfxBeginThread的具体例子以及如何在县城中调用  
  SetPaneText函数的

NO.1   作者: howtotell

定义一个全局变量:  
  LPVOID   p;  
  在对话框的类里边儿:  
  p=this;  
  在全局的地方:  
  extern   LPVOID   p;  
  在其它类的里边儿:  
  C***Dlg   *   dlg=static_cast<C***Dlg   *>(p);  
  CStatusBar*   pStauts;  
  pStatus=(CStatusBar*)  
  dlg->AfxGetApp()->m_pMainWnd->GetDescendantWindow(AFX_IDW_STATUS_BAR);  
         
  pStatus->SetPaneInfo(1,ID_SEPARATOR,SBPS_STRETCH,700);  
  pStatus->SetPaneText(0,"asdf");  
  pStatus->SetPaneText(1,"就绪");  
   
 

NO.2   作者: Cline

Pay   attention   to   "CWnd::AssertValid()".   Following   note   cut   from   it.  
   
  //   Note:   if   either   of   the   above   asserts   fire   and   you   are  
  //   writing   a   multithreaded   application,   it   is   likely   that  
  //   you   have   passed   a   C++   object   from   one   thread   to   another  
  //   and   have   used   that   object   in   a   way   that   was   not   intended.  
  //   (only   simple   inline   wrapper   functions   should   be   used)  
  //  
  //   In   general,   CWnd   objects   should   be   passed   by   HWND   from  
  //   one   thread   to   another.     The   receiving   thread   can   wrap  
  //   the   HWND   with   a   CWnd   object   by   using   CWnd::FromHandle.  
  //  
  //   It   is   dangerous   to   pass   C++   objects   from   one   thread   to  
  //   another,   unless   the   objects   are   designed   to   be   used   in  
  //   such   a   manner.  
 

NO.3   作者: tigerfox

其实你把状态栏窗口的hwnd,传入线程,然后SendMessage()  
  也可以把状态栏类的地址传进线程,然后引用一下就行了。

NO.4   作者: ok1234567

同意楼上:  
  消息驱动的系统,要多用消息:)  
  通常的做法应该为:向线程传送主窗口的句柄  
  由线程向主窗口发送消息  
  主窗口中用一个一致的方法更新状态条的控件

NO.5   作者: vcforever

我也建议你用消息来完成!  
  比较安全!比较简单!


 ·关于写日子问题    »显示摘要«
    摘要: 请问谁使用过servlet中getservletcontext().log()写过日志,谁知道如何配置log4的写日志。 ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE