Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why AfxGetInstanceHandle does not return a valid handle?

Status
Not open for further replies.

manumohan

Programmer
Apr 9, 2003
4
IN
Hi friends

I want to get the process handle to kill it. I tried to get it with AfxGetInstanceHandle. But it is always returning an invalid handle.How can i get a valid handle using AfxGetInstanceHandle

regards manu
 
If you haven't created a CWinApp object in your program or called AfxWinInit then don't count on a successful AfxGetInstanceHandle
 
If your application is not an MFC application you want to use GetModuleHandle(). The returned HMODULE is equivalent to HINSTANCE.

-pete


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top