![]() |
how to access Document in CMainFrame |
Post Reply
|
| Author | |
lyric_li
Newbie
Joined: 12 June 2006 Location: China Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Topic: how to access Document in CMainFramePosted: 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,
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 12 June 2006 at 11:04pm |
|
Hi, must be CMainFrame* pMainFrame= (CMainFrame*)AfxGetMainWnd() |
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
lyric_li
Newbie
Joined: 12 June 2006 Location: China Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
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? |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
lyric_li
Newbie
Joined: 12 June 2006 Location: China Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Posted: 08 July 2006 at 11:09pm |
|
thanks very much
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |