A preliminary understanding of the win32 interface library DuiLib

DuiLib is an open source win32 interface library; download link: https://github.com/duilib/duilib

You can make an interface similar to some anti-virus software; the effect is still relatively good;

First download a demo to have a look;

The current development tool is only the VS2010 Express version; open it and take a look; the DuiLib project is the source code; MFCDemo is an example;

    VS2010 Express does not support MFC, so there is a problem, and the demo cannot be run; Add a win32 project to the solution, an empty project; named duidemo;

Create a new demo.cpp;

#include "..\DuiLib\UIlib.h"

#ifdef _DEBUG
#   ifdef _UNICODE
#       pragma comment(lib, "DuiLib_ud.lib")
#   else
#       pragma comment(lib, "DuiLib_d.lib")
#   endif
#else
#   ifdef _UNICODE
#       pragma comment(lib, "DuiLib_u.lib")
#   else
#       pragma comment(lib, "DuiLib.lib")
#   endif
#endif

using namespace DuiLib;

class TestFrame : public WindowImplBase
{
public:
    TestFrame(){}
    ~TestFrame(){}

    virtual CDuiString GetSkinFolder()
    {
        return _T("");
    }
    virtual CDuiString GetSkinFile()
    {
        return _T("demo.xml");
    }
    virtual LPCTSTR GetWindowClassName(void) const
    {
        return _T("TestWindowClass");
    }
    virtual LRESULT OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
    {
        PostQuitMessage(0);
        return 0;
    }

    virtual void Notify(TNotifyUI& msg)
    {
        if (msg.sType == _T("click"))
        {
            if (msg.pSender->GetName() == _T("buttonName1"))
            {
                ::MessageBox(NULL, _T("buttonName1 has been clicked"), _T(""), NULL);
            }
        }
    }
    
private:

};

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int nCmdShow)
{
    CPaintManagerUI::SetInstance(hInstance);

    HRESULT Hr = ::CoInitialize(NULL);
    if (FAILED(Hr)) return 0;

    TestFrame* pFrame = new TestFrame();
    if (pFrame == NULL) return 0;
    pFrame->Create(NULL, _T("TestWindow"), UI_WNDSTYLE_FRAME, 0, 0, 0, 0, 0);
    pFrame->CenterWindow();
    ::ShowWindow(*pFrame, SW_SHOW);

    CPaintManagerUI::MessageLoop();

    ::CoUninitialize();
    return 0;
}

Build it, but the lib file is not found;

Use the absolute path to take a look; still can't find the lib file; open the sample folder, it turns out that it only has dll, not lib;

Lib and dll are obtained by generating the DuiLib project; generating this project; generating errors; there may be some problems with the express version;

Download a copy of lib and dll generated by netizens, as follows; copy to duidemo folder; generate, fail;

The next lib generated by netizens is as follows;

The generation is successful; as follows; the current computer's application policy restricts the operation of additional exe, you can generate it yourself; the simple example is just a window and a button;

It must be based on its original solution structure; because the included header file contains a bunch of other header files;
 

 

Guess you like

Origin blog.csdn.net/bcbobo21cn/article/details/113623472