// BmpWnd.cpp : implementation file // #include "stdafx.h" #include "resource.h" #include "NETCMD.h" #include "BmpWnd.h" #include "..\\..\\..\\..\\include\\l_ocx40.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CBitmapWnd dialog CBitmapWnd::CBitmapWnd(CWnd* pParent /*=NULL*/) : CDialog(CBitmapWnd::IDD, pParent) { //{{AFX_DATA_INIT(CBitmapWnd) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT m_pOwner=NULL; } void CBitmapWnd::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CBitmapWnd) DDX_Control(pDX, IDC_LEADCTRL1, m_LEAD1); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CBitmapWnd, CDialog) //{{AFX_MSG_MAP(CBitmapWnd) ON_WM_SIZE() ON_WM_CLOSE() ON_WM_ACTIVATE() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CBitmapWnd message handlers void CBitmapWnd::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); if(m_LEAD1 && ::IsWindow(m_LEAD1.m_hWnd)) m_LEAD1.SetWindowPos(NULL, 0, 0, cx, cy, SWP_SHOWWINDOW); } void CBitmapWnd::OnClose() { m_pOwner->RemoveKid(this); m_pOwner->m_lKids--; m_pOwner->RedimKids(); m_pOwner->m_pActiveKid=NULL; // Do Not call OnClose here. // m_pOwner->DeleteKid will close the window // CDialog::OnClose(); m_pOwner->DeleteKid(this); } short CBitmapWnd::SaveToFile(CString csFile, short nFormat, short nBitsPerPixel, short nQFactor, BOOL bMultiPage) { short nRet; short nModify; if(m_LEAD1.GetBitmap() != 0) { if(bMultiPage) nModify = SAVE_APPEND; else nModify = 0; nRet = m_LEAD1.Save(csFile, nFormat, nBitsPerPixel, nQFactor, nModify); } else nRet = ERROR_NO_BITMAP; return nRet; } void CBitmapWnd::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) { m_pOwner->m_pActiveKid = this; CDialog::OnActivate(nState, pWndOther, bMinimized); }