HINSTANCE AfxGetInstanceHandle( );Return ValueAn HINSTANCE to the current instance of the application. If called from within a DLL linked with the USRDLL version of MFC, an HINSTANCE to the DLL is returned.ResThis function allows you to retrieve the instance handle of the current application. AfxGetInstanceHandle always returns the HINSTANCE of your executable file (.EXE) unless it is called from within a DLL linked with the USRDLL version of MFC. In this case, it returns an HINSTANCE to the DLL.GetModuleHandle The GetModuleHandle function returns a module handle for the specified module if the file has been mapped into the address space of the calling process. HMODULE GetModuleHandle( LPCTSTR lpModuleName // address of module name to return handle // for );
Parameters lpModuleName Pointer to a null-terminated string that contains the name of the module (either a .DLL or .EXE file). If the filename extension is omitted, the default library extension .DLL is appended. The filename string can include a trailing point character (.) to indicate that the module name has no extension. The string does not have to specify a path. When specifying a path, be sure to use backslashes (\), not forward slashes (/). The name is compared (case independently) to the names of modules currently mapped into the address space of the calling process. If this parameter is NULL, GetModuleHandle returns a handle to the file used to create the calling process. Return Values If the function succeeds, the return value is a handle to the specified module.If the function fails, the return value is NULL. To get extended error information, call GetLastError. 请问HINSTANCE 和 HMODULE 可以相互转换吗?
The GetModuleHandle function returns a module handle for the specified module if the file has been mapped into the address space of the calling process. HMODULE GetModuleHandle(
LPCTSTR lpModuleName // address of module name to return handle
// for
);
Parameters
lpModuleName
Pointer to a null-terminated string that contains the name of the module (either a .DLL or .EXE file). If the filename extension is omitted, the default library extension .DLL is appended. The filename string can include a trailing point character (.) to indicate that the module name has no extension. The string does not have to specify a path. When specifying a path, be sure to use backslashes (\), not forward slashes (/). The name is compared (case independently) to the names of modules currently mapped into the address space of the calling process.
If this parameter is NULL, GetModuleHandle returns a handle to the file used to create the calling process. Return Values
If the function succeeds, the return value is a handle to the specified module.If the function fails, the return value is NULL. To get extended error information, call GetLastError.
请问HINSTANCE 和 HMODULE 可以相互转换吗?