惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threat Research - Cisco Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
V
Vulnerabilities – Threatpost
GbyAI
GbyAI
P
Proofpoint News Feed
L
LINUX DO - 热门话题
P
Palo Alto Networks Blog
A
About on SuperTechFans
T
Tenable Blog
M
MIT News - Artificial intelligence
IT之家
IT之家
I
Intezer
D
DataBreaches.Net
爱范儿
爱范儿
T
Threatpost
C
CERT Recently Published Vulnerability Notes
云风的 BLOG
云风的 BLOG
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
K
Kaspersky official blog
大猫的无限游戏
大猫的无限游戏
A
Arctic Wolf
Y
Y Combinator Blog
Cyberwarzone
Cyberwarzone
酷 壳 – CoolShell
酷 壳 – CoolShell
D
Darknet – Hacking Tools, Hacker News & Cyber Security
H
Help Net Security
Microsoft Security Blog
Microsoft Security Blog
Spread Privacy
Spread Privacy
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
AWS News Blog
AWS News Blog
博客园 - 聂微东
C
Check Point Blog
S
Securelist
有赞技术团队
有赞技术团队
雷峰网
雷峰网
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
Stack Overflow Blog
Stack Overflow Blog
MongoDB | Blog
MongoDB | Blog
D
Docker
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tailwind CSS Blog
L
Lohrmann on Cybersecurity
G
Google Developers Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LangChain Blog

博客园 - liuym

TB 编程整理 三 ICE开发初级研究 二 示例程序一 - liuym - 博客园 一 VC2008环境中ICE的配置 无法定位序数 3109 于LIBEAY32.dll - liuym 转:Virtual List的使用方法 转:VC++编程之CListCtrl控件的使用 2 转:VC++编程之CListCtrl控件的使用 好用 转:删除,修改注册表中需要设置权限的项 转:软件能够修复硬盘吗?―硬盘损坏全分析 VC 多文档窗口 子窗口最大化时切换窗口 窗口没有最大化显示的问题 转:Windows VC6编译安装Boost库 转:送给那些一心想要传送文件的朋友(TCP协议).cpp-from CSDN 转:如何去了解、熟悉一个已经开发完的项目 进行维护、二次开发或者升级 递归创建文件夹 DLL中资源和主程序资源冲突 - liuym - 博客园 转:一种巧妙的删除程序自己的方法 转:双缓冲图形刷新技术 和 WGF双缓冲绘图框架 软件保护建议(转)
转:CWnd 对象怎么和 HWND 窗口句柄相互转化
liuym · 2010-06-23 · via 博客园 - liuym

 CWnd   *wnd;   
  HWND   hWnd;   
    
  它们怎么相互转换?

1.wnd->m_wnd;   
  2.CWnd   *wnd=CWnd::FromHandle(hwnd)

你是说要强制转换吗?恐怕不行吧?wnd是窗口指针,hWnd是窗口句柄呀!不过可以互相获取,如下:   
          hWnd=wnd->m_hWnd;   
          wnd.Atach(hWnd)
建立一个CWnd对象,然后使用Attach将HWND和CWnd对象联系起来   
    
  static   CWnd*   PASCAL   FromHandle(   HWND   hWnd   );通过HWND构造一个CWnd*指针(但该指针在空闲时会被删除,所以不能保存供以后使用)。

//CWnd   Object   to   HWND:   
  CWnd   wnd;   
  HWND   hWnd;   
    
  hWnd   =   wnd.m_hWnd;           
  //   or   
  hWnd   =   wnd.GetSafeHwnd(); //推荐   
    
  //   HWND   to   CWnd   Object:   
  CWnd   *pWnd;   
  HWND   hWnd;   
    
  pWnd   =   CWnd::FromHandle(hWnd);   
  //   or   
  pWnd->Attach(hWnd);

posted on 2010-06-23 13:53  liuym  阅读(2074)  评论()    收藏  举报