Solved

CWnd * from HWND

Posted on 2000-02-13
4
680 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Studio Exe Issue, 12 40
Application vs Workbook.applicaiton 3 49
Which Microsoft MSDN Package Is The One I need? 3 51
Where does legacy ASP.NET initialize language? 2 99
This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
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…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 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