Solved

AfxGetMainWnd() function in VisualStudio 8

Posted on 2006-07-13
2
445 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 125 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
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…

770 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