我如何从cdc获得cwnd? [英] How can i get cwnd from a cdc ?

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

问题描述

以allah的名义



玩得开心



i使用visual c ++ 2012。



如何在ActiveX项目中从CDC获得CWnd?



谢谢



我的尝试:



我试过吼叫代码但不起作用。



void CLanxXCtrl :: OnDraw(

CDC * pdc,const CRect& rcBounds,const CRect& rcInvalid )

{



HWND h = WindowFromDC(pdc-> m_hDC);

CWnd * w = CWnd :: FromHandle(h);





...

}



这个CWnd会起作用但Project中的ActiveX不可见,OnDraw功能在运行时不起作用。



我该怎么做?

in the name of allah

have a good time

i work with visual c++ 2012.

how can i get the "CWnd" from a "CDC" in an ActiveX project?

thanks

What I have tried:

i've tried bellow code but doesn't work.

void CLanxXCtrl::OnDraw(
CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{

HWND h=WindowFromDC(pdc->m_hDC);
CWnd *w=CWnd::FromHandle(h);


...
}

this CWnd will work but cause of the ActiveX in Project is not visible, the OnDraw function doesn't work in run time.

how can i do that?

推荐答案

你已经有了一个指向与CDC相关的MFC窗口对象的指针 - 它是这个指针你正在调用的函数。
You've already got a pointer to the MFC window object associated with the CDC - it's the this pointer for the function you're calling.


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

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