Summarized several articles on the internet, http://blog.csdn.net/shanzhizi
Version 2.0
First cracked skin Library: http://download.csdn.net/detail/shanzhizi/4275425
After decompression, follow the steps below.
Enter Corona. SMF, skinmagiclibmd6.lib, and skinmagiclib. h In the program folder.
Add code in stdafx. h
# Include "skinmagiclib. H"
// # Pragma comment (Lib, "skinmagiclibmd6trial. lib ")
# Pragma comment (Lib, "skinmagiclibmd6.lib ")
/* When "use MFC in a static library" is selected in Project/setting/General,
The following two statements are required:
*/
# Pragma comment (linker, "/Force: Multiple ")
# Pragma comment (linker, "/OPT: Noref ")
Add a header file to the main file
# Define compile_multimon_stubs
# Include "multimon. H"
Add it at the beginning of bool cmdidemoapp: initinstance ()
Verify (1 = initskinmagiclib (AfxGetInstanceHandle (), _ T ("Demo "),
Null,
Null ));
Verify (1 = loadskinfile (_ T ("Corona. SMF ")));
At the end of the pmainframe-> showwindow (m_ncmdshow );
Pmainframe-> updatewindow ();
Previously added
Verify (1 = setwindowskin (m_pmainwnd-> m_hwnd, _ T ("mainframe ")));
Setcontroltooltip (pmainframe-> m_wndtoolbar.m_hwnd, _ T ("toolbar "));
Verify (1 = setdialogskin (_ T ("dialog ")));
After that, the compilation is successful. Continue to reload wm_create or wm_initdialog for the subwindow.
Add the code setwindowskin (m_hwnd, _ T ("mainframe "));
Version 2.2
1. Download skinmagic toolkit and copy skinmagictrial. dll, skinmagictrial. Lib, skinmagiclib. h, and the skin file Corona. SMF to the project directory. (This is relatively simple. You can download it here .)
2. Add the header file and library reference in stdafx. h as follows:
# I nclude "skinmagiclib. H"
# Pragma comment (Lib, "skinmagictrial. lib ")
L use skinmagic
1. initialize the skinmagic Library:
Int _ stdcall initskinmagiclib (hinstance,
Lptstr lpapplication,
Lpctstr lpreserved1,
Lpctstr lpreserved2 );
Add the code to initialize the skinmagic library in cxxxapp: initinstance:
Verify (1 = initskinmagiclib (AfxGetInstanceHandle (), null ));
2. Import skin files:
There are two methods for calling skin: one is to call it directly from the skin file, and the other is to call it from the resource file, which are described as follows:
1) Call the skin from the skin file:
Int _ stdcall loadskinfile (lpctstr lpskinfile );
2) Call the skin from the resource file:
Int _ stdcall loadskinfromresource (hmodule,
Lpctstr lpskinname,
Lpctstr lptype );
The code in cxxxapp: initinstance () is as follows:
Bool cxxxapp: initinstance ()
{
Verify (1 = initskinmagiclib (AfxGetInstanceHandle (), null ));
Verify (1 = loadskinfile ("Corona. SMF "));
Afxenablecontrolcontainer ();
//..... Bottom
}
3. Apply the skin to a program
Int _ stdcall setwindowskin (hwnd, lpctstr lpskinname );
Int _ stdcall setdialogskin (lpctstr szskinname );
1) Position of the program code in the dialog box:
Bool cxxxapp: initinstance ()
{
//...
M_pmainwnd = & DLG;
Verify (1 = setwindowskin (m_pmainwnd-> m_hwnd, "mainframe "));
Verify (1 = setdialogskin ("dialog "));
Int nresponse = DLG. domodal ();
//... Bottom
}
2) Position of the program code in the document view
Bool cxxxapp: initinstance ()
{
//... Upper Limit
M_pmainwnd-> showwindow (sw_show );
M_pmainwnd-> updatewindow ();
Verify (1 = setwindowskin (m_pmainwnd-> m_hwnd, "mainframe "));
Verify (1 = setdialogskin ("dialog "));
Return true;
}
4. Release skinmagic Resources
Void _ stdcall exitskinmagiclib ();
Load the exitinstance () function of the application and add the following code:
Int cxxxapp: exitinstance ()
{
Exitskinmagiclib ();
Return cwinapp: exitinstance ();
}
1. Upload the three files skinmagiclib. H, detours. Lib, and skinmagiclib. lib to the project directory.
NOTE: If your project uses the shared DLL, You need to select the shared DLL's skinmagiclib. H, skinmagiclib. Lib
If your program uses a static connection DLL, you can choose static skinmagiclib. H, skinmagiclib. Lib
Otherwise the connection goes wrong...
2. "project"-> Add to project-> file-> Add detours. lib and skinmagiclib. lib to project
3. In stdafx. H, add # include "skinmagiclib. H"
4. Upload skin files to the "REC" folder in the project directory.
5. Switch to resourceview In the workspace, right-click and select "introduce". In the displayed dialog box, find the skin file, and insert it to the project file.
In the following dialog box, enter "skinmagic", and insert the skin file to this folder.
6. After the skin file is inserted into the project, you can find the ID of the skin file in resourceview, right-click the property, and change the ID name.
7. Find the cxxxapp class in classview, find the initinstance () function, and then
M_pmainwnd-> showwindow (sw_show );
M_pmainwnd-> updatewindow ();
Add the following code before:
Verify (1 = initskinmagiclib (AfxGetInstanceHandle (), "Demo ",
Null,
Null ));
Verify (1 = loadskinfromresource (AfxGetInstanceHandle (), "xpgreen", "skinmagic "));
Verify (1 = setwindowskin (m_pmainwnd-> m_hwnd, "mainframe "));
Verify (1 = setdialogskin ("dialog "));
8. In the cxxxapp class, right-click addvirtualfunction, add the exitinstance () function, and add:
Exitskinmagiclib ();
9. Compile, connect, execute... OK, skin added...
Use skinmagic toolkit to beautify the interface
[Preparations]
1. Place skinmagictrial. dll in the debugging directory.
2. Set the library file directory and add skinmagictrial. lib to the [additional dependencies] of the project [connector ].
3. Add the header file # include "skinmagiclib. H" to the stdafx. h file of the project"
[Creation process]
1. initialize the skinmagic Library:
To use skinmagic, this step is essential. In the initinstance () function of the application class, add the following code (in bold ):
Cwinapp: initinstance ();
Verify (1 = initskinmagiclib (AfxGetInstanceHandle (), null,
Null, null ));
Note:
Int initskinmagiclib (// initialize the skinmagic tool Library
Hinstance, // application handle
Char * szapplication, // The application name defined in the skin file. Set it to null.
Char * szregcode, // use the registration code for skinmagic. If null is not set
Char * szreserved2 // Reserved Bit, null
);
2. Import skin files:
There are two methods for calling skin: one is to call it directly from the skin file, and the other is to call it from the resource file, which are described as follows:
1) Call the skin from the skin file: Add the following code to the last sentence:
Verify (1 = loadskinfile ("Corona. SMF "));
2) Call the skin from the resource file:
Verify (1 = loadskinfromresource (null, "Futura", "skin "));
// The resource name is enclosed in double quotation marks
Int loadskinfromresource (
Hmodule, // module handle containing skin files. If the null surface is in this module
Char * lpskinname, // name of the skin Resource
Char * lptype); // Resource Type
3. Add skin for the window:
1) add skin for a standard window (with title bar, system menu, variable size, and other features, such as document/View Structure and menus dialog box), which is usually used in the main window. Add the following code to the bottom of the initinstance () function of the application class:
Verify (1 = setwindowskin (m_pmainwnd-> m_hwnd, "mainframe "));
M_pmainwnd-> showwindow (sw_show );
M_pmainwnd-> updatewindow ();
Note:
Int setwindowskin (
Hwnd, // The Window handle to use skin
Char * lpskinname // The name specified for the skinframewnd object
);
2) add skin for the dialog box
Called before the dialog box is displayed. It is usually called in the application initialization function.
Verify (1 = setwindowskin (m_pmainwnd-> m_hwnd, "mainframe "));
Verify (1 = setdialogskin ("dialog "));
M_pmainwnd-> showwindow (sw_show );
M_pmainwnd-> updatewindow ();
Note:
Int setdialogskin (
Char * lpskinname // The name specified for the skinframewnd object
);
After this function is used, this skin will be used in the subsequent dialogs created by the program, but the dialog box size will not change.
3) add skin to a single dialog box window. For example, in the dialog box view, add the following code to create the oncreate function in the reload dialog box View:
Verify (1 = setsingledialogskin (m_hwnd, "dialog "));
Enablewindowscrollbarskin (m_hwnd, sb_both );
Note:
Int setsingledialogskin (
Hwnd, // The Window handle to use skin
Char * lpskinname // The name specified for the skinframewnd object
);
Int enablewindowscrollbarskin (// Add skin for the scroll bar
Hwnd, // The Window handle to use skin
Int * fnbar // the scroll bar of the skin to be used. sb_both indicates that the skin is used both horizontally and vertically.
);
4. Release skinmagic Resources
Load the exitinstance () function of the application and add the following code:
Exitskinmagiclib ();