Click here to Skip to main content
15,885,988 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am writing an activeX control in Visual C++ 6.0
I would like to have an hWnd parameter in one of my methods, so that I can set the parent of a window from a seperate process, so it'll be a child window of the dialog the activeX (*.ocx) is embedded in.
I've tried making a method like this for example:

C++
double CMyActiveXControlCtrl::Parent(HWND Parent);
{
SetParent(Parent, ... )
return 0.0;
}


But it won't work because I have to add the method via right click on tree view item -> add method.
When that is done in the Visual C++ IDE, it still won't work because there is no hWnd parameter to select in the drop down menu, There is long, short, float, bool, LPCTSTR, OLE_HANDLE, etc but none of them are what I need. What do I need for setting a struct HWND__ * method parameter? What am I doing wrong?

Thanks!
TKG
Posted

1 solution

You need to use OLE_HANDLE.

You have to typecast HWND to OLE_HANDLE (and vice versa). Check the following link for a sample:

http://us.generation-nt.com/answer/how-do-you-cast-an-hwnd-an-ole-handle-help-9254962.html[^]
 
Share this answer
 
Comments
time-killer-games 15-Aug-12 18:20pm    
Thanks! This is awesome! I haven't tested it yet but I'm pretty certain it will work... You're awesome ;)
manoranjan 16-Aug-12 0:07am    
You are welcome:) Glad to be of help.

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