GetConsoleWindow Function
Retrieves the window handle used by the console associated with the calling process.
GetModuleHandle Function
Retrieves a module handle for the specified module. The module must have been loaded by the calling process.
To avoid the race conditions described in the Remarks section, use the GetModuleHandleEx function.