修改DUILIB任务栏中显示的图标和EXE图标

  在资源中添加ICO图标,获取属性名,在主窗口文件中的函数InitWindow或OnCreate中添加如下代码:

SetIcon(IDR_MAINFRAME);

  修改EXE显示图标,在主窗口中加入如下代码:

int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{  
    CPaintManagerUI::SetInstance(hInstance); 

    CCFrameDraw duiFrame;
    duiFrame.Create(NULL, _T("DUIWnd"), UI_WNDSTYLE_FRAME, WS_EX_WINDOWEDGE);

    HICON hIcon = ::LoadIcon(hInstance,MAKEINTRESOURCE(IDI_ICON2));
    ::SendMessage(duiFrame.GetHWND(),STM_SETICON,IMAGE_ICON,(LPARAM)(UINT)hIcon);

    duiFrame.CenterWindow();
    duiFrame.ShowModal();
    
    return 0;
}

 

posted @ 2017-02-06 10:20  公子綦  阅读(3573)  评论(0编辑  收藏  举报