具有hWnd参数的ActiveX控件方法 [英] ActiveX Control Method with hWnd Parameter

查看:155
本文介绍了具有hWnd参数的ActiveX控件方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Visual C ++ 6.0中编写一个activeX控件.
我想在我的一种方法中使用hWnd参数,以便可以从单独的进程中设置窗口的父窗口,这样它将成为嵌入了activeX(* .ocx)的对话框的子窗口in.
我试过制作这样的方法,例如:

  double  CMyActiveXControlCtrl :: Parent(HWND Parent);
{
SetParent(父母,...)
返回  0 . 0 ;
} 



但这是行不通的,因为我必须通过右键单击树视图项->来添加该方法.添加方法.
在Visual C ++ IDE中完成此操作后,它仍然无法正常工作,因为在下拉菜单中没有hWnd参数可供选择,其中有long,short,float,bool,LPCTSTR,OLE_HANDLE等,但都没有是我所需要的.设置struct HWND__ *方法参数需要什么?我做错了什么?

谢谢!
TKG

解决方案

您需要使用OLE_HANDLE.

您必须将HWND强制转换为OLE_HANDLE(反之亦然).检查以下链接以获取示例:

http://us. generation-nt.com/answer/how-do-you-cast-an-hwnd-an-ole-handle-help-9254962.html [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

解决方案

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[^]


这篇关于具有hWnd参数的ActiveX控件方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆