"Abhishek" <shake...activelement.comwrote in message
news:OMOas5w3GHA.508...TK2MSFTNGP06.phx.gbl...
Quote: Originally Posted by how do you convert HWND to HMODULE or if you have the HWND how do u get its HMODULE. |
Dave's reply is correct, of course; there is no one-to-one mapping between
window handles and module handles so going from module to window is
problematic.
That said,
1) GetWindowThreadProcessId() will map a window to its owning process and
return a process id
2) OpenProcess() takes a process id and returns a process handle
3) EnumProcessModules() takes a process handle and returns a _set_ of
handles; 1 for each module in the process
If you go that route, don't forget to release any resources (handles) you
allocate.
Also, realize that your success in steps 2 and 3 depends on the security
context in which you try to get that information and the security context of
the target process
Regards.
Will
williamdepalomvpvc
| Thu, 03 Jan 2008 13:10:00 GMT |