墨香年少 32 发布于 2023年8月9日 1.make sure theme.zip file (D:\duilib\project\duilib_hello\Release\Res\theme.zip) exists. if file not exists, you can download from there: theme.zip 2.modfile app.h #pragma once #include <windows.h> #include "resource.h" #include "UIlib.h" using namespace DuiLib; 3.modfile app.cpp #include "app.h" class MainWndFrame : public WindowImplBase { protected: virtual CDuiString GetSkinFolder() override; virtual CDuiString GetSkinFile() override; virtual LPCTSTR GetWindowClassName(void) const override; virtual DuiLib::UILIB_RESOURCETYPE GetResourceType() const override; virtual LPCTSTR GetResourceID() const override; public: static const LPCTSTR kClassName; static const LPCTSTR kMainWndFrame; }; DuiLib::CDuiString MainWndFrame::GetSkinFolder() { return m_PaintManager.GetInstancePath(); } DuiLib::CDuiString MainWndFrame::GetSkinFile() { return kMainWndFrame; } LPCTSTR MainWndFrame::GetWindowClassName(void) const { return kClassName; } DuiLib::UILIB_RESOURCETYPE MainWndFrame::GetResourceType() const { return UILIB_ZIPRESOURCE; } LPCTSTR MainWndFrame::GetResourceID() const { return MAKEINTRESOURCE(IDR_ZIPRES1); } const LPCTSTR MainWndFrame::kClassName = _T("main_wnd"); const LPCTSTR MainWndFrame::kMainWndFrame = _T("main_wnd.xml"); int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); // 设置窗口关联的实例 CPaintManagerUI::SetInstance(hInstance); // 设置皮肤的默认路径 CPaintManagerUI::SetCurrentPath(CPaintManagerUI::GetInstancePath()); CPaintManagerUI::SetResourcePath(_T("theme")); // 创建窗口 MainWndFrame* pMainWndFrame = new MainWndFrame; pMainWndFrame->Create(nullptr, MainWndFrame::kClassName, UI_WNDSTYLE_DIALOG, 0); pMainWndFrame->CenterWindow(); pMainWndFrame->ShowWindow(); CPaintManagerUI::MessageLoop(); if (nullptr != pMainWndFrame) { delete pMainWndFrame; } return 0; } 3. add theme.zip to resource 4. build and run the project... 5. now you can copy the exe and past exe file to every, and run it success no any dll or other files. just a exe file. 6. if you open this exe use winrar , you will see the xml file 目之所及,皆是回忆,心之所想,皆是过往 分享这篇帖子 链接帖子 分享到其他站点