Click here to Skip to main content
12,945,706 members (55,634 online)
Rate this:
Please Sign up or sign in to vote.
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:

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?

Posted 13-Aug-12 8:59am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You need to use OLE_HANDLE.

You have to typecast HWND to OLE_HANDLE (and vice versa). Check the following link for a sample:[^]
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)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 4,899
CHill60 3,180
Maciej Los 2,453
Jochen Arndt 1,910
ppolymorphe 1,785

Advertise | Privacy | Mobile
Web01 | 2.8.170518.1 | Last Updated 14 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100