user8495585
user8495585

Reputation:

Somehow possible to get a HMODULE from a HANDLE?

How can I get the HMODULE from an open process handle in visual c++ ? For example: If I have a handle to another Process (created with OpenProcess) and I want to get the HMODULE of the handle ?

Is this just a simple cast?

(HMODULE)myHandle;

Upvotes: 1

Views: 2589

Answers (1)

Iridium
Iridium

Reputation: 23731

You can't just cast, but you can pass it to EnumProcessModules to retrieve the list of modules associated with the given process. The first module returned is the primary module for the process, so you can (probably) pass a buffer that can hold just a single HMODULE.

Upvotes: 3

Related Questions