Archived

This topic is now archived and is closed to further replies.

Acquire a View HANDLE :: MFC

This topic is 5704 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I often see function parameters requiring a handle to a window. I believe the handle to main fram is m_hWnd. In general, how do you get a handle to a window from main frame to any view including splitters? Thanks, Kuphryn

Share this post


Link to post
Share on other sites
CFrameWnd::GetActiveView
CFrameWnd::GetActiveDocument
CDocument::GetFirstViewPosition
CDocument::GetNextView

You get the picture.

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ ]
[ MS RTFM [MSDN] | SGI STL Docs | Boost ]
[ Google! | Asking Smart Questions | Jargon File ]
Thanks to Kylotan for the idea!

Share this post


Link to post
Share on other sites
Thanks.

A member at CodeProject mentioned using IsWindow() to make sure a handle is a handle to a valid window. However, IsWindow() take not parameters and returns a BOOL. I am not sure how to "check" a handle using that function.

Kuphryn

Share this post


Link to post
Share on other sites
To clarify any confusions, the reason I am asking about HANDLE to MFC windows is, as a member at Anandtech mentioned, I need to pass it to API functions especially winsock. I am shifting gear to network programming in Windows.

Kuphryn

Share this post


Link to post
Share on other sites
quote:
Original post by kuphryn
A member at CodeProject mentioned using IsWindow() to make sure a handle is a handle to a valid window. However, IsWindow() take not parameters and returns a BOOL. I am not sure how to "check" a handle using that function.



::IsWindow takes an HWND. CWnd has a member m_hWnd that holds its HWND.

Share this post


Link to post
Share on other sites