summaryrefslogtreecommitdiff
path: root/win
diff options
context:
space:
mode:
authorleo2006-01-19 06:55:22 +0000
committerleo2006-01-19 06:55:22 +0000
commit633c4ee66a14a6d7df81d82e315df64d7f4b10d8 (patch)
treef28b397ee7b509729239a6075e065c903c183e01 /win
parent61509914135b457c839c6b69f70be0d927729ad9 (diff)
Fixed crash under VC++ 7.1
git-svn-id: http://svn.leocad.org/trunk@457 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'win')
-rw-r--r--win/Bmpmenu.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/win/Bmpmenu.cpp b/win/Bmpmenu.cpp
index 98fb39f..00b748a 100644
--- a/win/Bmpmenu.cpp
+++ b/win/Bmpmenu.cpp
@@ -709,7 +709,9 @@ BOOL CBMPMenu::LoadFromToolBar(UINT nID,UINT nToolBar,int& xoffset)
BOOL returnflag=FALSE;
CToolBar bar;
- bar.Create(AfxGetMainWnd());
+ CWnd* pWnd = AfxGetMainWnd();
+ if (pWnd == NULL)pWnd = CWnd::GetDesktopWindow();
+ bar.Create(pWnd);
if(bar.LoadToolBar(nToolBar)){
offset=bar.CommandToIndex(nID);
if(offset>=0){
@@ -916,6 +918,7 @@ void CBMPMenu::InsertSpaces(void)
m_fontMenu.CreateFontIndirect (&m_lf);
CWnd *pWnd = AfxGetMainWnd();
+ if (pWnd == NULL)pWnd = CWnd::GetDesktopWindow();
CDC *pDC = pWnd->GetDC();
CFont* pFont = pDC->SelectObject (&m_fontMenu);
@@ -955,7 +958,7 @@ void CBMPMenu::InsertSpaces(void)
}
}
pDC->SelectObject (pFont); // Select old font in
- AfxGetMainWnd()->ReleaseDC(pDC); // Release the DC
+ pWnd->ReleaseDC(pDC); // Release the DC
m_fontMenu.DeleteObject();
}