1 GetModuleFileName (); // Gets the file path of the module, when the first parameter is null, gets the path of the current process's file 2 GetModuleHandle (); // Gets the handle to the file of the current process when the parameter is NULL for the handle of the module
1 SendMessage (Hwnd_broadcast,wm_settingchange,0, (LPARAM) TEXT ("environment" ));
1 //to determine if an environment variable exists, use the following function:2 DWORD WINAPI getenvironmentvariable (3 __in LPCTSTR lpname,4 __out LPTSTR lpbuffer,5 __in DWORD nSize6 );7 //use the following function to set the value of an environment variable, and if the value is set to NULL, delete the variable in the environment block. 8 BOOL WINAPI setenvironmentvariable (9 __in LPCTSTR lpname,Ten __in LPCTSTR Lpvalue One ); A //for character swapping in%xxxx% form, use the following function to expand: - DWORD WINAPI expandenvironmentstrings ( - __in LPCTSTR lpsrc, the __out LPTSTR LPDST, - __in DWORD nSize -);
1 // get the full environment block 2 Freeenvironmentstrings (Lptch); // need to be released after using the environment block
Chapter core programming on Processes