Write yourself installed production procedures

zhaozj2021-02-11  201

Write yourself installed production procedures

Deng Zhenbo

This is a class I used to implement the installation program that contains some of the functions used by the installer. Of course, due to the relationship between work and time, there is no complete writing, there are many places that need to be improved, now this class Provided to everyone, make more interested peers to study more in depth. This type of functionality includes checking the system version, operation registry, directory, file operation, establishing shortcuts, performs external programs, restarts computer, registration OCX, DLL components, etc. Basic installation functions. Because the entire source program is relatively long, only the header files of this class are listed here, and the source files are downloaded from here, when connecting the program, you have to add a Version.lib connection.

class CSetup {public: int GetWindowsVersion (CString & strVersion, WORD & wLangage, WORD & wCodePage); // get the Windows version, the return value the version, parameter returns specific language information BOOL RegistrActiveServer (LPCSTR lpszOcxFileName, BOOL bRegister = TRUE); // Register OCX, DLLBOOL ISSERVER (); // System Whether Serve Edition Bool CheckwindowVersion (Bool & BNT, DWORD & DWMAJOR, DWORD & DWMINOR); // Detects Windows version information BOOL ISNT (); // System Whether Windows Nt Bool Iswin2000 (); / / The system win200bool iswinnt4 (); // system is NT4BOOL ISWINNT351 (); // Bool iswindows98 (); // system is 98 and above BOOL ISWINDOWS95 (); // System is 95 and other

Uint getTempFileName (CSTRING & STRUNIQUNAME, LPCSTR LPPREFIXSTRING = NULL); // Get unique temporary file name Dword getSystemppath (CSTRING & StrtemppPath); // Get system temporary directory

LONG RegWriteData (LPCTSTR pszSection, LPCTSTR pszEntry, const BYTE * btVal, DWORD dwLength, HKEY hKey = HKEY_LOCAL_MACHINE); // write to the registry data LONG RegWriteLong (LPCTSTR pszSection, LPCTSTR pszEntry, DWORD dwVal, HKEY hKey = HKEY_LOCAL_MACHINE); // write to the registry integer LONG RegWriteString (LPCTSTR pszSection, LPCTSTR pszEntry, LPCSTR pszVal, HKEY hKey = HKEY_LOCAL_MACHINE); // write to the registry string LONG RegReadData (LPCTSTR pszSection, LPCTSTR pszEntry, BYTE * btVal, DWORD dwLength, HKEY hKey = HKEY_LOCAL_MACHINE); // read data from the registry BOOL DeleteKey (LPCTSTR pszSubKey, LPCTSTR pszValueName, HKEY hKey = HKEY_LOCAL_MACHINE); // delete registry keys, pszValueName not empty all across key following keys are deleted LONG RegReadLong (LPCTSTR pszSection, LPCTSTR pszEntry, DWORD & dwVal, HKEY hKey = HKEY_LOCAL_MACHINE); // integer LONG RegReadString read from the registry (LPCTSTR pszSection, LPCTSTR pszEntry, CString & sVal, HKEY hKey = HKEY_LOCAL_MACHINE); // read from the registry Take string DWORD getMemorySize (CSTRING & STRDECRISZIE); // Get memory size Bool getDriverfreespace (Char chDRIVER, CSTRING & STRDESCRIPT); // Get the remaining space of disk

BOOL ShutDownComputer (UINT uFlag = EWX_REBOOT); // restart the computer on or off BOOL CreateProcess (LPSTR lpszFileName); // execute a program BOOL ShellExecuteEx (LPCSTR lpsFileName, LPCSTR lpszParam = NULL, LPCSTR lpszMode = "OPEN"); // perform Some files or programs

BOOL CreateShortCutOnDesktop (LPCSTR lpszFullPathName, LPCSTR lpszLinkName); // build a desktop shortcut BOOL CreateShortCutOnProgramGroup (LPCSTR lpszFullPathName, LPCSTR lpszLinkName); // Start menu, create a shortcut BOOL CreateShortCut (const CString strSrcPath, const CString strPathLink); // create a shortcut

Bool AddTostartup (LPCSTR LPSZFULLFILEPATH, BOOL BrunOnce = false); // Add to start the program with your computer

BOOL DeleteFolder (LPCSTR lpzsFolderName, DWORD dwDelFlags = 0); // delete folders BOOL CreatePath (LPCSTR lpszFullPathName); // Create a directory BOOL GetStartupPath (CString & strPath); // get the startup directory BOOL GetDesktopPath (CString & strPath); // get Desktop path BOOL GetProgramGroupPath (CString & strPath); // get the program set path BOOL GetWindowsPath (CString & strWinPath, CString & strWinSysPath); // get Windows directory BOOL DeleteFile (LPCSTR lpszFileName); // delete the file BOOL CopyFile (LPCSTR lpszSrc, LPCSTR lpszDec, DWORD DWFLAG = FOF_ALLOWUNDO | FOF_SILENT); // Copy file Bool SetupCheckieversion (int & mark "; // Detect IE version

INT StartUpaT (lpctstr lpszname, lpctstr lpszexefile, hkey nrootkey = null); Program starts to start Virtual ~ csetup ();

Private: cregkey m_regkey; // Registry Operation DWORD M_DWVERSION; // Used to determine version bool m_bnt; public: dword m_dwwinvermajor; // system version DWORD M_DWWINVERMINOR; // system version};

Download source file

More articles at http://seesi.51.net

转载请注明原文地址:https://www.9cbs.com/read-6084.html

New Post(0)