duilib duilib Concise Guide to Getting Started tutorial 7.XML Foundation Classes

Now it should describe XML interface is not so strange, so we do further introduction.
  Previous tutorial we write a lot of code, in order to let everyone know at the basic process, in fact, duilib already common operations done a very good package, so no need to write code like so many previous tutorials formal use, here we come take a look at XML wrapper class WindowImplBase:
  WindowImplBase class is the base class duilib framework that encapsulates common operations, in order to facilitate use. It is based on XML as an interface description, so use it when we need to interface description written in XML.
  The following will be our Hello World program to achieve the third time ~ O (∩_∩) O ~

  1. class CDuiFrameWnd : public WindowImplBase
  2. {
  3. public:
  4.     virtual LPCTSTR    GetWindowClassName() const   {   return _T("DUIMainFrame");  }
  5.     virtual CDuiString GetSkinFile()                {   return _T("duilib.xml");  }
  6.     virtual CDuiString GetSkinFolder()              {   return _T("");  }
  7. };
  8. int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
  9. {
  10.     CPaintManagerUI::SetInstance(hInstance);
  11.     CDuiFrameWnd duiFrame;
  12.     duiFrame.Create(NULL, _T("DUIWnd"), UI_WNDSTYLE_FRAME, WS_EX_WINDOWEDGE);
  13.     duiFrame.CenterWindow();
  14.     duiFrame.ShowModal();
  15.     return 0;
  16. }
Copy the code


 Only about 10 lines of code key, is not it more simple? Future tutorials will further introduce WindowImplBase use and function ~   Note: Due to _tWinMain function is not substantially changed, so if there is no change, later in the tutorial no longer list the code because the back of the tutorial basically only needs to be changed CDuiFrameWnd classes and XML files.

Guess you like

Origin www.cnblogs.com/blogpro/p/11427064.html