1. 程式人生 > >獲取當前應用程式例項(instance:HINSTANCE)

獲取當前應用程式例項(instance:HINSTANCE)

if using MFC AfxGetInstanceHandle(). For console programs, call GetConsoleWindow() to get the HWND then GetWindowLong() to get the HINSTANCE.

For the Win32 API, you could also use GetModuleHandle():

//get instance of current program (self)
HINSTANCE hInst= GetModuleHandle (0);