如何获取MainWindow句柄 [英] How to GetMainWindow Handle

查看:400
本文介绍了如何获取MainWindow句柄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MFC类创建GUI.
在主窗口中,我有一个Active X控件.

如何从Active X控件获取主窗口的句柄值?
任何想法都将非常有帮助...

解决方案

一个快速的Google建议 [^ ]可能会有所帮助.

如果您需要主窗口的句柄,并且正在使用mfc框架,则可以调用AfxGetMainWnd(),此指针将重新调整CWnd *,它将成为您的主窗口(CMainFrame或CDialog或CMdiFrameWnd)

希望这会有所帮助:)


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...

解决方案

A quick google suggests that this[^] might help.


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 :)


这篇关于如何获取MainWindow句柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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