Solved

CWnd * from HWND

Posted on 2000-02-13
4
668 Views
Last Modified: 2013-12-03
Given that I have a HWND is there a way to get a CWnd pointer for the window? I want to call CWnd functions for the window. I am intercepting WM_ message and I would like to call class functions to return approprite values.

Jason

0
Comment
Question by:Lucidity
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
NickRepin earned 200 total points
Comment Utility
CWnd::Attach  
BOOL Attach( HWND hWndNew );

Return Value

Nonzero if successful; otherwise 0.

Parameters

hWndNew

Specifies a handle to a Windows window.

Remarks

Attaches a Windows window to a CWnd object.

0
 
LVL 15

Expert Comment

by:NickRepin
Comment Utility
CWnd w;
w.Attach(hWnd);
0
 
LVL 86

Expert Comment

by:jkr
Comment Utility
Alternatively,

CWnd* CWnd::FromHandle();

or

CWnd* CWnd::FromHandlePermanent();

could do it also...
0
 

Author Comment

by:Lucidity
Comment Utility
Arg, I guess I missed that in MSDN.... But thanks for the regurgetation. I will try it our and get back to you.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now