基于WindowImplBase 更简单,才是标准的

时间:2021-06-02 13:22:22   收藏:0   阅读:0

dui界面基于

https://github.com/dingyuanhong/dui_ffplay/

常用的教程  https://github.com/jiangrongbo/duilib-tutorial

extern "C"
{
#include "common.h" //ff相关
}

#include <Windows.h>

#include "../DuiLib/UIlib.h"

using namespace DuiLib;
#pragma comment(lib,"../lib/DuiLib_u.lib")

class MyWnd : public WindowImplBase{
    LPCTSTR GetWindowClassName() const{
        return L"MyWnd";
    }
    UINT GetClassStyle() const{
        return UI_CLASSSTYLE_FRAME | CS_DBLCLKS;
    }
    CDuiString GetSkinFile(){
        return L"UFPlayer.xml";
    }
    CDuiString GetSkinFolder(){
        return CPaintManagerUI::GetResourcePath();
    }
    void Notify(TNotifyUI& msg){
        if (msg.sType == L"click"){
            if (msg.pSender->GetName() == L"IDCLOSE"){
                ::PostQuitMessage(0);
            }
            else if (msg.pSender->GetName() == L"IDSTOP"){
                ::SendMessage(m_hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
            }
        }
    }
};

int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow){
    CPaintManagerUI::SetInstance(hInstance);
    CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetResourcePath());
    //创建主窗口
    MyWnd* pFrame = new MyWnd();
    pFrame->Create(NULL, L"Tutorial5", UI_WNDSTYLE_FRAME^WS_THICKFRAME, WS_EX_WINDOWEDGE);
    pFrame->CenterWindow();
    pFrame->ShowWindow(true);
    CPaintManagerUI::MessageLoop();
    return 0;
}

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!