Solved

AfxGetMainWnd() function in VisualStudio 8

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Decoding 32 bit binary streams 6 54
Annoying "thing" blocks my view 4 132
Message not shown 5 85
Increment column based of a FK 8 51
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.

733 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