Solved

CWnd * from HWND

Posted on 2000-02-13
4
672 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
ID: 2518002
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
ID: 2518004
CWnd w;
w.Attach(hWnd);
0
 
LVL 86

Expert Comment

by:jkr
ID: 2519546
Alternatively,

CWnd* CWnd::FromHandle();

or

CWnd* CWnd::FromHandlePermanent();

could do it also...
0
 

Author Comment

by:Lucidity
ID: 2519638
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 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