用的都是全局变量,做一个调试器,在打开调试文件过程中可以正确显示,打开文件完成后就不显示了。我在打开文件后给主窗口发消息,主窗口的消息处理函数完成在状态栏添加一indicator并显示路径,哪位大虾告诉我啊。

解决方案 »

  1.   

    在主框架中:
    m_wndStatusBar.SetPaneText(iPaneIndex, sShowStr, FALSE);iPaneIndex是你显示字符串的小窗口的位置,sShowStr是要显示的字符串。这样做,我这里没有问题,不知道你怎么实现的,仅供参考
      

  2.   

    Q
    How do I update the text of a pane in a status bar?A
    By default, a CStatusBar pane is not enabled when the pane is created. To activate a pane, you must call the ON_UPDATE_COMMAND_UI() macro for each pane on the status bar and update the panes. Because panes do not send WM_COMMAND messages, you cannot use ClassWizard to activate panes; you must type the code manually. For example, suppose one pane has ID_INDICATOR_PAGE as its identifier and that it contains the current page number in a document. To make the ID_INDICATOR_PAGE pane display text, add the following to a header file (probably the MAINFRM.H file): afx_msg void OnUpdatePage(CCmdUI *pCmdUI); 
    Add the following to the application message map: ON_UPDATE_COMMAND_UI(ID_INDICATOR_PAGE, OnUpdatePage) 
    Add the following to a source code file (probably MAINFRM.CPP): void CMainFrame::OnUpdatePage(CCmdUI *pCmdUI)
    {
        pCmdUI->Enable();

    To display text in the panes, either call SetPaneText() or call CCmdUI::SetText() in the OnUpdate() function. For example, you might want to set up an integer variable m_nPage that contains the current page number. Then, the OnUpdatePage() function might read as follows: void CMainFrame::OnUpdatePage(CCmdUI *pCmdUI)
    {
        pCmdUI->Enable();
        char szPage[16];
        wsprintf((LPSTR)szPage, "Page %d", m_nPage);
        pCmdUI->SetText((LPSTR)szPage);

    This technique causes the page number to appear in the pane during idle processing in he same manner that the application updates other indicators.
      

  3.   

    我用的就是SetPaneText,我的是MDI会不会是调试文件打开后被什么东西刷新了啊?我用CCmdUI则根本没有显示。
      

  4.   

    你的状态条的那些indicator的ID不是用的原来的吧?如果是原来的,系统可能会刷新,我一般都将他们改成自己的ID
      

  5.   

    原来的caps、NUM、SCRL我都保留了,新的区域是自己定义在string table 里然后动态加载的,会不会是因为主框架变了所以才刷新啊
      

  6.   

    FT,[email protected]给我发邮件或者留下邮箱
      

  7.   

    ^_^,给我也发一份,[email protected]
      

  8.   

    呵呵,我还以为你用的它的网络硬盘呢:)[email protected]
      

  9.   

    我的问题解决了,我的UI写在CMainFrame里了,应该写在状态条那个类里。