Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

AfxGetMainWnd() function in VisualStudio 8

Posted on 2006-07-13
2
Medium Priority
?
461 Views
Last Modified: 2013-11-20
Hi Experts,

I have to port our sourcecode from Visual Studio 6 to Visual Studio 8 (2005).

In the existing code quite at the beginning of the program the function OnNewDocument() is called.
Calls made there to  AfxGetMainWnd()  return NULL in Visual Studio 8 while they return useful values when the same sourcecode is compiled with Visual Studio 6.


At that point there is still no window drawn
0
Comment
Question by:PYTHALAB
2 Comments
 
LVL 2

Accepted Solution

by:
snyp earned 500 total points
ID: 17187039
create a pointer to the CMainFrame object and use that pointer instead of what AfxGetMainWnd() is returning. the CMainFrame object remains constant throughout the lifetime of the application's runtime, so there's no reason to call AfxGetMainWnd() to return it for you when it's there already.
0
 
LVL 1

Author Comment

by:PYTHALAB
ID: 17200895
Thank you very much !!!
This works and helped me now a lot.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Suggested Courses
Course of the Month21 days, 4 hours left to enroll

810 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