Solved

CWnd * from HWND

Posted on 2000-02-13
4
669 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
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…

920 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

15 Experts available now in Live!

Get 1:1 Help Now