How to Use skinmagic-change skin for VC development programs
Since I learned VC, I began to have a great deal of interest in MFC programming. So I went around to look for apps written with VC and learned a few tricks, you can also write a small application for fun. So the first one is the "autorun. inf immune device". The code is not a problem, but the control and skin of vc6.0 are a little hard to see ...... What? Texture by yourself? I don't have the skills ...... However, one day I discovered this -- skinmagic, which just met my requirements.
Search for skinmagictoolkit on Baidu and download it. The file contains the following: skinmagiclib. h header file; skinmagic. lib + skinmagic. DLL dynamic connection library file; skinmagiclibmd6.lib released static Connection Library; skinmagiclibmt6.lib debugged static Link Library. Because a new handwritten application like me is also an executable file, here we will first talk about the static Link Method and load the skin file into the resource.
1. Put skinmagiclib. h and skinmagiclibmt6.lib in the project directory.
2. Add # include "skinmagiclib. H" to the CPP file where the C *** app is located ".
3. Add skinmagiclibmd6.lib to the object/library modules under the link tab of the menu project | settings to add the static library of the released version to the project.
4. Load the skin to the resource. In the resource view, right-click the project name import and select the skin file (in the skin file). In the displayed dialog box, enter skinmagic in the resource type field. Change the resource ID to idr_skin_xpgrean (take xpgrean. SMF as an example ).
5. Add the following code to the beginning of the initinstance () function of the C *** app:
Verify (1 = initskinmagiclib (AfxGetInstanceHandle (), _ T ("readui"), null, null); // Initialization
Verify (1 = loadskinfromresource (null, (lpstr) idr_skin_xpgrean, "skinmagic"); // load Skin Resources
Verify (1 = setdialogskin ("dialog"); // set the dialog box skin
If it is a document program, add the following code:
Verify (1 = setwindowskin (m_pmainwnd-> m_hwnd, "mainframe"); // set the window skin
The above functions are defined and explained in detail in the skinmagiclib. h header file.
For details about how to use verify, refer to msdn.
6. Open classwizard and add the exitinstance () function to the C *** app. Add the following code to release the skinmagic Resource:
Exitskinmagiclib ();
7. Compile and run the program. The window looks much better.
You can also try other skins. Of course, if you think your own skins are not good enough, you can also find skinmagicsdk and use skinbuilder to edit your own skins.
If you use a dynamic library, you only need to put skinmagic. lib and skinmagic. DLL dynamic connection library file put in the project folder, skinmagic. LIB can be imported to the project, but the release requires skinmagic. DLL files are released together.
OK, skin change successful! If you have read the text above, you can ask me something you don't understand. I will explain it to you so far!