Click here to Skip to main content
15,886,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using MFC classes to create GUI.
Inside the Main window I have an Active X control.

How can I get the handle value of the main window from the Active X control??
Any idea will be very helpful...
Posted

A quick google suggests that this[^] might help.
 
Share this answer
 
If you need handle of the main window, and if you are using mfc framework , you can call AfxGetMainWnd() this pointer retuns a CWnd* which will be your main window(CMainFrame or CDialog or CMdiFrameWnd)

hopes this helps :)
 
Share this answer
 
Comments
Debojyoti Majumder 2-Feb-11 2:22am    
Yes... I have used the method you said, but it's returning some other value.

I tried to use Spy++, and trace which window it's returning.
But the returned value was not matching any window.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900