Solved

AfxGetMainWnd() function in VisualStudio 8

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 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

9 Experts available now in Live!

Get 1:1 Help Now