Click here to Skip to main content
15,911,132 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: where are dialog box saved on disk Pin
David Crow23-Oct-07 3:54
David Crow23-Oct-07 3:54 
AnswerRe: where are dialog box saved on disk Pin
David Crow23-Oct-07 3:50
David Crow23-Oct-07 3:50 
QuestionDLL property Pin
George_George22-Oct-07 19:01
George_George22-Oct-07 19:01 
AnswerRe: DLL property Pin
chnuser22-Oct-07 19:07
chnuser22-Oct-07 19:07 
GeneralRe: DLL property Pin
George_George22-Oct-07 20:31
George_George22-Oct-07 20:31 
AnswerRe: DLL property Pin
Naveen22-Oct-07 19:47
Naveen22-Oct-07 19:47 
GeneralRe: DLL property Pin
George_George22-Oct-07 20:49
George_George22-Oct-07 20:49 
Questionwhy CreateView(&ccontext, AFX_IDW_PANE_FIRST) return NULL in win2000? Pin
chnuser22-Oct-07 18:58
chnuser22-Oct-07 18:58 
In SDI struct.I just want to create a toolbar in myFrameWnd(not in CMainFrame) .Xp OS ,everything is ok .but win2000 OS CreateView(&ccontext, AFX_IDW_PANE_FIRST) returns NULL. Why?


1. i wrote a class like this:

------------------------.h file---------------------------------------------

class CViewCgMap;

class CFrameWndCgMap : public CFrameWnd

{
DECLARE_DYNCREATE(CFrameWndCgMap)

protected:
CFrameWndCgMap();

virtual ~CFrameWndCgMap();

protected:

CXTPDockingPaneManager m_paneManager;
CDlgAttrib *m_pdlgAttrib;

CViewCgMap *m_pNewView;

DECLARE_MESSAGE_MAP()
public:

afx_msg void OnNcPaint();

afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);

};

-----------------------------.cpp file-----------------------

#include "ViewCgMap.h"


// CFrameWndCgMap

IMPLEMENT_DYNCREATE(CFrameWndCgMap, CFrameWnd)

CFrameWndCgMap::CFrameWndCgMap() : m_pdlgAttrib(NULL), m_pNewView(0), m_pDoc(0)
{
}

CFrameWndCgMap::~CFrameWndCgMap()
{

}

BEGIN_MESSAGE_MAP(CFrameWndCgMap, CFrameWnd)
ON_WM_CREATE()
ON_WM_NCPAINT()
END_MESSAGE_MAP()


// CFrameWndCgMap

#ifdef _DEBUG
void CFrameWndCgMap::AssertValid() const
{
CFrameWnd::AssertValid();
}

void CFrameWndCgMap::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG

int CFrameWndCgMap::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;

//
CCreateContext ccontext;
ccontext.m_pNewViewClass = RUNTIME_CLASS(CViewCgMap);
ccontext.m_pCurrentDoc = NULL;
ccontext.m_pNewDocTemplate = *NULL;
ccontext.m_pLastView = NULL;
ccontext.m_pCurrentFrame = this;


m_pNewView = STATIC_DOWNCAST(CViewCgMap, CFrameWnd::CreateView(&ccontext, AFX_IDW_PANE_FIRST)); // WHY THIS CODE RETURNS NULL in win2000 OS?Confused | :confused:
if (!m_pNewView)
{
MessageBox("can't create view");
//return -1;
}
else
{
AFX_IDW_PANE_FIRST, &ccontext);
m_pNewView->OnInitialUpdate();
SetActiveView(m_pNewView);
m_pNewView->ShowWindow(SW_SHOW);
RecalcLayout();
}

//

if (!InitCommandBars())
{
return -1; // fail to create
}

CXTPCommandBars* pCommandBars = GetCommandBars();

// LOADTOOLBAR

CXTPToolBar* pCommandBar = (CXTPToolBar*)pCommandBars->Add(_T("Map"), xtpBarBottom);
if (!pCommandBar ||
!pCommandBar->LoadToolBar(IDR_TOOLBAR_MAP))
{
TRACE0("Failed to create toolbar\n");
return -1;
}

// LOAD TOOLBAR

CXTPToolBar* pExtendedBar = (CXTPToolBar*)pCommandBars->Add(_T("Edit"), xtpBarBottom);
if (!pExtendedBar ||
!pExtendedBar->LoadToolBar(IDR_TOOLBAR_MAP_EDIT))
{
TRACE0("Failed to create toolbar\n");
return -1;
}

DockRightOf(pExtendedBar, pCommandBar);

// Initialize the docking pane manager and set the
// initial them for the docking panes. Do this only after all
// control bars objects have been created and docked.
m_paneManager.InstallDockingPanes(this);
m_paneManager.SetTheme(xtpPaneThemeOffice);

// Create docking panes.
CXTPDockingPane* pwndPane1 = m_paneManager.CreatePane(
IDR_PANE_ATTRIB, CRect(0, 0,200, 120), dockBottomOf);

//pwndPane1->SetOptions(xtpPaneNoCloseable);

m_paneManager.SetTheme(xtpPaneThemeOffice2003);
return 0;
}


void CFrameWndCgMap::OnNcPaint()
{
CFrameWnd::OnNcPaint();

CWnd *pWnd = AfxGetMainWnd();
if (pWnd)
{
pWnd->SendMessage(WM_SIZE);
}
}

---------------------------view class------------------

class CViewCgMap : public CView
{
DECLARE_DYNCREATE(CViewCgMap)

protected:
CViewCgMap(); //
virtual ~CViewCgMap();

public:

public:
virtual void OnDraw(CDC* pDC); //
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif

protected:
DECLARE_MESSAGE_MAP()
public:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnBtnZoomin();
};

Help Help............................krying.

QuestionAccess violation writing location 0x10161b7c. Pin
monsieur_jj22-Oct-07 17:14
monsieur_jj22-Oct-07 17:14 
QuestionDynamic Enums Pin
aplatoon22-Oct-07 15:25
aplatoon22-Oct-07 15:25 
AnswerRe: Dynamic Enums Pin
Michael Dunn22-Oct-07 20:17
sitebuilderMichael Dunn22-Oct-07 20:17 
QuestionPlugin for windows 3.1 \ 3.11 ???? Pin
media90Cj22-Oct-07 14:27
media90Cj22-Oct-07 14:27 
QuestionGDI+ help needed Pin
Kiran Satish22-Oct-07 11:34
Kiran Satish22-Oct-07 11:34 
AnswerRe: GDI+ help needed Pin
Llasus22-Oct-07 13:14
Llasus22-Oct-07 13:14 
GeneralRe: GDI+ help needed Pin
Kiran Satish22-Oct-07 15:50
Kiran Satish22-Oct-07 15:50 
QuestionHow do you send a button click message to parent window Pin
littleGreenDude22-Oct-07 8:07
littleGreenDude22-Oct-07 8:07 
AnswerRe: How do you send a button click message to parent window Pin
David Crow22-Oct-07 8:43
David Crow22-Oct-07 8:43 
GeneralRe: How do you send a button click message to parent window Pin
littleGreenDude22-Oct-07 8:47
littleGreenDude22-Oct-07 8:47 
GeneralRe: How do you send a button click message to parent window Pin
Maximilien22-Oct-07 8:55
Maximilien22-Oct-07 8:55 
GeneralRe: How do you send a button click message to parent window Pin
David Crow22-Oct-07 9:00
David Crow22-Oct-07 9:00 
GeneralRe: How do you send a button click message to parent window Pin
Randor 22-Oct-07 10:37
professional Randor 22-Oct-07 10:37 
AnswerRe: How do you send a button click message to parent window Pin
Paresh Chitte22-Oct-07 19:05
Paresh Chitte22-Oct-07 19:05 
AnswerRe: How do you send a button click message to parent window Pin
Naveen22-Oct-07 19:53
Naveen22-Oct-07 19:53 
AnswerRe: How do you send a button click message to parent window Pin
Mark Salsbery23-Oct-07 8:57
Mark Salsbery23-Oct-07 8:57 
QuestionCTreeCtrl and SetRedraw Pin
bob1697222-Oct-07 5:08
bob1697222-Oct-07 5:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.