Load the skin from the resource, use the free zipper appface for vc 0.2 to beautify your software

xiaoxiao2021-03-06  62

Since the unit has recently developed a small item in an internal use, I need a stable operation to put the skin files in the resource and easy to use interface development kit, of course, free. So using Google's madness, hey, I really found such a development library: AppFace for VC 0.2.

AppFace for VC supports Win9X / NT / 2K / XP, Unicode / ANSI, which enables all WiDOWS standard controls, system menus, general dialogs, etc. in the target process, which is completely free of non-commercial use. . The key is that AppFACE is very simple, it is easy to add to existing projects. I am using the version 0.2, you can also go to its website http://www.appface.com to download the latest version.

AppFACE supports three skin load methods, loaded from disk files, loaded from resource loading from memory. Let me talk about how to load URF skin files from the resource:

First, make sure you download the AppFace for VC development package, we want to use three files: "AppFace.h", "AppFace.dll", "gtclassic.urf".

Then, create a VC executable file engineering, the MDI / SDI / Dialog / Win32 type can be created to create a Dialog Engineering RESSKIN. Copy "AppFace.h" into the project directory, copy "AppFace.dll" into the output directory of the project, for example: "Debug /", copy "gtclassic.urf" to the directory where the resource is located. Enter the resource management entry in the VC's project manager, select "Import" in the Right-click menu, add "gtclassic.urf" into the project, the resource type is set to: "MyRestype", the resource ID is set to "iDR_MY_URF". Note: Before the resource ID must be added to double quotes.

All of the preparations is completed, and now you have entered the topic: 1. Add: #include "appface.h" in relasskin.cpp: # c c 中 中 如 中下 代下 代下

Cresskinapp :: InitInstance () {... cappface af; // line 1af.start (_T ("iDR_MY_URF"), GTP_LOAD_RESOURCE, NULL, _T ("mytype"), null); // line 2

Cresskindlg DLG; m_pmainwnd = & dlg; int nresponse = dlg.domodal ();

... Af.Remove (); // Line 3

}

Compile ... Everything is done!

3. The above is an official approach, because AppFACE also supports loading URF from memory, so you can do this:

Cresskinapp :: InitInstance () {... cappface af; // init

// loadif (HRSRC HR = :: FindResource (NULL, "iDR_MY_URF", "MyType")) {ulong nressize = :: sizeofresource (null, hr); if (Hglobal Hz = :: loadResource (null, hr)) { CHAR * P = (char *) LockResource (Hz); if (p) AF.Start (p, gtp_load_memory, nressize, null, null);}}

Cresskindlg DLG; m_pmainwnd = & dlg; int nresponse = dlg.domodal ();

... AF.Remove (); // Release} You can use this method to load other data from the resource.

It should be noted that if the URF is added to the resource, the resource ID is not enclosed in double quotes. When loading: AF.Start (_T ("iDR_MY_URF"), GTP_LOAD_RESOURCE, NULL, MAKEINTRESOURCE (_t ("mytype" ))), NULL)); // Line 2

Running effect Figure 4, conclude:

I also try to use other interface development libraries, I feel that AppFACE is the most easy to use, the fastest load speed, and good stability. However, its free version only provides three URF skin files, slightly sorry. Welcome to reprint.

转载请注明原文地址:https://www.9cbs.com/read-84955.html

New Post(0)