Print Page | Close Window

how to access Document in CMainFrame

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=4402
Printed Date: 29 May 2025 at 8:36am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: how to access Document in CMainFrame
Posted By: lyric_li
Subject: how to access Document in CMainFrame
Date Posted: 12 June 2006 at 10:31pm

Hi everyone,

I'm a new comer in using Xtreme Toolkit software.  I meet a problem with the UI development now. I used the demo codes which implements with outlook-style UI for the framework. And I want to  add some buttons in the toolbar to process some data in Doc.h, But I can't get the pointer to C**Doc class . Since CMainFrame class in this demo project is derived from CXTPFrameWnd, which seems not derived from MFC. So when I write

CWnd* pWnd= AfxGetMainWnd();

CMainFrame* pMainFrame= pWnd->GetParentFrame();

It doesn't wok well. pMainFrame always returns NULL. So I couldn't access Doc class by this way

C**Doc*  pDoc= pMainFrame->GetActiveDocument();

How could I get the reference to the frame window for this situation ?Hope anyone could give me a hand.

Thanks  very much,

 




Replies:
Posted By: Oleg
Date Posted: 12 June 2006 at 11:04pm

Hi,

must be

CMainFrame* pMainFrame= (CMainFrame*)AfxGetMainWnd()



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: lyric_li
Date Posted: 12 June 2006 at 11:28pm

thank you very much,it works

and how can I reference to Doc class by this pMainFrame pointer?

CMainFrame is derived from CXTPFrameWnd class which is not just like CFrameWnd class offered methods of accessing Doc class.

or there are some other ways to solve it? 



Posted By: Oleg
Date Posted: 13 June 2006 at 7:45am

CXTPFrameWnd is derived from CFrameWnd... so

C**Doc*  pDoc= pMainFrame->GetActiveDocument();

will work.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: lyric_li
Date Posted: 08 July 2006 at 11:09pm
thanks very muchSmile



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net