我是在状态栏增加个时钟的显示我从网上下载个皮肤库加载后(皮肤库是在C**App初始化的时候进行初始化的)时钟不能正常显示了,后来把皮肤库卸载后恢复正常我是在CMainFrame::OnCreate()中添加的SetTimer(1,1000,NULL);有没有好办法既能够加载皮肤有能够正常显示时钟

解决方案 »

  1.   

    settimer(1,500,null);//换肤
    settimer(2,500,null;//显示时钟
    ontimer(nidevent)
    {if(nidevent==1)
    //换肤
    if(nidevent==2)
    //时钟
    }
      

  2.   

    还是不行,我说详细点
    BOOL CEx12aApp::InitInstance()//应用程序向导的初始化
    {
    AfxEnableControlContainer(); // Standard initialization
    // If you are not using these features and wish to reduce the size
    //  of your final executable, you should remove from the following
    //  the specific initialization routines you do not need.#ifdef _AFXDLL
    Enable3dControls(); // Call this when using MFC in a shared DLL
    #else
    Enable3dControlsStatic(); // Call this when linking to MFC statically
    #endif // Change the registry key under which our settings are stored.
    // TODO: You should modify this string to be something appropriate
    // such as the name of your company or organization.
    SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings();  // Load standard INI file options (including MRU)
    InitializeSkin(_T("XPCorona.ssk"));............1.//调用初始化皮肤的函数
    // Register the application's document templates.  Document templates
    //  serve as the connection between documents, frame windows and views. CSingleDocTemplate* pDocTemplate;
    pDocTemplate = new CSingleDocTemplate(
    IDR_MAINFRAME,
    RUNTIME_CLASS(CEx12aDoc),
    RUNTIME_CLASS(CMainFrame),       // main SDI frame window
    RUNTIME_CLASS(CEx12aView));
    AddDocTemplate(pDocTemplate); // Parse command line for standard shell commands, DDE, file open
    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line
    if (!ProcessShellCommand(cmdInfo))
    return FALSE; // The one and only window has been initialized, so show and update it.
    m_pMainWnd->ShowWindow(SW_SHOW);
    m_pMainWnd->UpdateWindow(); return TRUE;
    }
    2.调用settimer()的CMainFrame
    nt CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
    return -1;

    if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
    | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
    !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
    {
    TRACE0("Failed to create toolbar\n");
    return -1;      // fail to create
    } if (!m_wndStatusBar.Create(this) ||
    !m_wndStatusBar.SetIndicators(indicators,
      sizeof(indicators)/sizeof(UINT)))
    {
    TRACE0("Failed to create status bar\n");
    return -1;      // fail to create
    }
    m_wndStatusBar.SetPaneInfo(1,ID_INDICATOR_CLOCK,SBPS_STRETCH,25);//显示时钟
    // TODO: Delete these three lines if you don't want the toolbar to
    //  be dockable
    m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
    EnableDocking(CBRS_ALIGN_ANY);
    DockControlBar(&m_wndToolBar); SetTimer(4,1000,NULL);//设定间隔时间 return 0;
    }
    //响应settimer
    void CMainFrame::OnTimer(UINT nIDEvent) 
    {
    // TODO: Add your message handler code here and/or call default
    CTime tmCurr;
    CString strTime;
    tmCurr=CTime::GetCurrentTime();
    strTime=tmCurr.Format("%H:%M:%S");
    m_wndStatusBar.SetPaneText(m_wndStatusBar.CommandToIndex(ID_INDICATOR_CLOCK),strTime);
    CFrameWnd::OnTimer(nIDEvent);
    }
    //关闭
    void CMainFrame::OnClose() 
    {
    // TODO: Add your message handler code here and/or call default
    KillTimer(4);
    CFrameWnd::OnClose();
    }
    现在的问题就是标号为 1 的地方,也就是初始化库的函数调用InitializeSkin(_T("XPCorona.ssk"))
    假如删除这个函数调用,状态栏的时钟正常显示.
    反之不能.是什么问题啊,在线等啊!!