Compile your own software installation program
This is just a file for creating the installer type. Of course, it cannot be created. After searching for documents for many days and reading English for many days, we can finally create an msi file. Opening it with orca is the correct file format and it is worth record, the various table relationships in the msi database are complex and can be clearly studied at no later than half past one. record a beginning first. Hope that the experts who have studied msi c ++ programming can give some guidance. The goal is to write a program attached to the software program, so that the installation program msi file can be directly generated after compilation. Just like software that is normally downloaded, you can write a registry, create a desktop shortcut, and register the components and functions used by various software. The simple hello world Program is also very small, and it looks professional.
Sample program
#pragma once//CRT headers.#include
//windows platform headers.#include
//msi headers.#pragma comment(lib,"msi.lib")#include
#include
INT APIENTRY _tWinMain(HINSTANCE,HINSTANCE,LPTSTR,INT){MSIHANDLE msiHandle=NULL;//create msi database.UINT openResult=MsiOpenDatabase(_T("Setup.msi"),MSIDBOPEN_CREATEDIRECT,&msiHandle);//create msil database failed.if(openResult != ERROR_SUCCESS){LPVOID formatMsg=NULL;MSIHANDLE errorCode=MsiGetLastErrorRecord();//format error code to string.FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,NULL,errorCode,MAKELANGID(LANG_NEUTRAL,SUBLANG_SYS_DEFAULT),(LPTSTR)&formatMsg,0,NULL);//output error message.MessageBoxEx(NULL,(LPTSTR)formatMsg,_T("tip window"),MB_OK, MAKELANGID(LANG_NEUTRAL,SUBLANG_SYS_DEFAULT));//free message buffer.LocalFree(formatMsg);formatMsg=NULL;return -1;}//commit msi database.UINT commitResult=MsiDatabaseCommit(msiHandle);if(commitResult != ERROR_SUCCESS){LPVOID formatMsg=NULL;MSIHANDLE errorCode=MsiGetLastErrorRecord();//format error code to string.FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,NULL,errorCode,MAKELANGID(LANG_NEUTRAL,SUBLANG_SYS_DEFAULT),(LPTSTR)&formatMsg,0,NULL);//output error message.MessageBoxEx(NULL,(LPTSTR)formatMsg,_T("tip window"),MB_OK, MAKELANGID(LANG_NEUTRAL,SUBLANG_SYS_DEFAULT));//free message buffer.LocalFree(formatMsg);formatMsg=NULL;return -1;}//close msi database handle.UINT closeResult=MsiCloseHandle(msiHandle);if(closeResult != ERROR_SUCCESS){LPVOID formatMsg=NULL;MSIHANDLE errorCode=MsiGetLastErrorRecord();//format error code to string.FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,NULL,errorCode,MAKELANGID(LANG_NEUTRAL,SUBLANG_SYS_DEFAULT),(LPTSTR)&formatMsg,0,NULL);//output error message.MessageBoxEx(NULL,(LPTSTR)formatMsg,_T("tip window"),MB_OK, MAKELANGID(LANG_NEUTRAL,SUBLANG_SYS_DEFAULT));//free message buffer.LocalFree(formatMsg);formatMsg=NULL;return -1;}return 0;}
The results show that my research is not very clear, but the ultimate goal is to write your own software requires an installation program, so it looks professional, always green software is unwilling.
Zookeeper