Skinload program interface skin replacement tool
Author: Ma haizeng
Download the sample project in this article
Skinload v0.3
Link to the VC Knowledge Base
Note: skinload is a tool to skin your program. You can add beautiful skins to your application through a few simple function calls, including all system dialogs. The skinloadmaker skin editing tool allows you to customize your skin.
The interface is as follows:
How to skin in a program:
I. Static link dynamic library
Three files are required: "skinloadlib. H", "skinload. lib", "skinload. dll"
1. Add the "skinloadlib. H" and "skinload. lib" files to the project.
2. Include the header file in the app class:
#include "SkinLoadLib.h"
3. initialize the dynamic library in the initinstance () function of the app class and load the skin file:
Initskinload (getcurrentthreadid (); loadskin ("xp_normal.skin"); // It can be stored anywhere. If different files contain paths
4. Uninstall the dynamic library in the exitinstance () of the app class and release the resources used:
ExitSkinLoad();
Note: This is convenient to use. The disadvantage is that the skinload. dll file must exist when the program is running. Otherwise, the program cannot run.
Ii. Dynamic Loading of dynamic Databases
1. Load the dynamic library in the initinstance () function of the app class.
Define a variable to save the loaded dynamic library handle, which can be global or a member variable of the app class
HINSTANCE m_hDllSkin;m_hDllSkin = LoadLibrary("SkinLoad.dll");
2. Call the initialization function and the function for loading skin files in the initinstance () function of the app class.
if(m_hDllSkin != NULL){typedef int (* INITSKIN)(DWORD dwThreadId);typedef bool (* LOADSKIN)(char* cPath);INITSKIN pInitSkin = (INITSKIN)GetProcAddress(m_hDllSkin,"InitSkinLoad");LOADSKIN pLoadSkin = (LOADSKIN)GetProcAddress(m_hDllSkin,"LoadSkin");if(pInitSkin != NULL && pLoadSkin != NULL){(*pInitSkin)(GetCurrentThreadId());(*pLoadSkin)("xp_normal.skin");}}
3. Uninstall the dynamic library in the exitinstance () of the app class
if(m_hDllSkin != NULL){typedef bool (* EXITSKIN)();EXITSKIN pExitSkin = (EXITSKIN)GetProcAddress(m_hDllSkin,"ExitSkin");if(pExitSkin != NULL){(*pExitSkin)();} FreeLibrary(m_hDllSkin);}
Note: This operation is troublesome. You need to manually load the dynamic library and retrieve the function pointer for reuse. However, in this way, you can determine whether the required skinload. dll dynamic library exists in the program, so that the program cannot run.
Skin Preparation tool skinloadmaker instructions for use:
The program comes with a skin file. You only need to modify the corresponding place when creating your own skin file. If you do not make any changes, you can directly generate a skin file, which is the same as my xp_normal.skin. When you run skinloadmaker, a temp folder is generated, which contains the pictures used by the program. You can change the format.
Note:
Title Bar background image: There are two requirements: one is normal, the other is the focus of the program is lost, put in the order of top and bottom in a picture
Title Bar buttons: including minimization, maximization, restoration, and closure. Each image contains four small images: Normal, mouse on, Mouse down, and disabled.
Button bitmap: Optional. Four statuses are also put in one figure. They are normal, mouse on, Mouse down, and disabled.
(Full text)