I have always wanted to make a beauty program for my own vc6, so I found this skinmagic. Although there are many instructions on the use of this software on the internet, however, in actual use, you will always encounter some problems. After repeated exploration and summarization, you will have this article, hoping to help you.
Procedure:
1. Put skinmagiclib. H, skinmagiclibmt6.lib, and skinmagiclibmd6.lib in your vc6 project directory.
2. Add in stdafx. h
# Include "skinmagiclib. H"
3. Add the corresponding Library to the Project Settings
Note: 1. When using DLL, skinmaigc. dll and program packaging are required during program release. 2. If you use a static library, you do not need to rely on the DLL file. The specific method is: Prerequisites 1: You have selected use MFC in a static lirary in project/settings/General/. In this case, you must use the static library skinmagiclibmt6.lib for both Debug and release versions. 1) debug version: Select "Debug multithreaded" under C ++/code generation of project/setting ". 2) release version: Select "multithreaded" Prerequisites 2: You have selected use MFC in a shared DLL in project/settings/General/. In this case, you must use the static library skinmagiclibmd6.lib for both Debug and release versions. 3) debug version: Select "Debug multithreaded DLL" under C ++/code generation of project/setting ". 4) release version: Select "multithreaded DLL" |
In this example, MT indicates multithreaded, while MD indicates multithreaded DLL. Select under the generation label. If your project uses a static library of the MT type, select "Debug multithreaded" and "release" for the debug version. Select "multithreaded" for the version. If you want to use a static library of the MD type, select "Debug multithreaded DLL" and "release" for the debug version. Select "multithreaded DLL ". Self-built http://www.pediy.com/bbshtml/BBS6/pediy6615.htm |
4. Add the code to initialize the skinmagic resource at the beginning of the initinstance () function.
Verify (1 = initskinmagiclib (AfxGetInstanceHandle (), "Demo ", Null, Null )); Verify (1 = loadskinfile ("devior. SMF ")); Verify (1 = setdialogskin ("dialog"); // set the skin of the dialog box |
5. Load the skin file in the initinstance () function and set the program skin.
You can add skin files to resources and compile them into programs. Or the program dynamically loads skin files at runtime.
A. For example, add Corona. SMF, set the resource type to "skinmagic", and the resource ID to idr_skin_corona.
Cbosskeydlg DLG;
M_pmainwnd = & DLG;
// Load skinmagic skin
Verify (1 = loadskinfromresource (null, (lpstr) idr_skin_corona, "skinmagic "));
Verify (1 = setwindowskin (m_pmainwnd-> m_hwnd, "mainframe"); // set the window skin
Verify (1 = setdialogskin ("dialog"); // set the skin of the dialog box
Int nresponse = DLG. domodalex (bstartshow );
If (nresponse = idok)
{
}
Else if (nresponse = idcancel)
{
}
B. The program dynamically loads skin files during runtime
Cbosskeydlg DLG;
M_pmainwnd = & DLG;
// Load skinmagic skin
Verify (1 = loadskinfile ("Corona. SMF "));
Verify (1 = setwindowskin (m_pmainwnd-> m_hwnd, "mainframe "));
Verify (1 = setdialogskin ("dialog "));
Int nresponse = DLG. domodalex (bstartshow );
If (nresponse = idok)
{
}
Else if (nresponse = idcancel)
{
}
6. Release skinmagic Resources in the exitinstance () function
// Release the skinmagic Resource:
Exitskinmagiclib ();