/*[]=====================================================================[]*/ /*[] LEADTOOLS for Windows(Class Library) - Version 11 []*/ /*[] []*/ /*[] []*/ /*[] Copyright (c) 1991-2000 LEAD Technologies, Inc. []*/ /*[] All Rights Reserved. []*/ /*[]=====================================================================[]*/ /*---(EZFunc)--------------------------------------------------------------- This example does the following: 1. Gets an image file name from the command line. 2. Loads the image into a bitmap, and updates the display palette. 3. Creates a window, using the default window size. 4. Fits the image in the window, while preserving the aspect ratio. 5. Displays the image. Usage: CLezfn32.exe --------------------------------------------------------------------------*/ // smlView.cpp : implementation of the CSmlView class // #include "stdafx.h" #include "ezfnload.h" #include "ezfnDoc.h" #include "ezfnView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CSmlView IMPLEMENT_DYNCREATE(CSmlView, CView) BEGIN_MESSAGE_MAP(CSmlView, CView) //{{AFX_MSG_MAP(CSmlView) ON_WM_CREATE() ON_COMMAND(ID_ALL_ERRORS, OnAllErrors) ON_UPDATE_COMMAND_UI(ID_ALL_ERRORS, OnUpdateAllErrors) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CSmlView construction/destruction CSmlView::CSmlView() { // TODO: add construction code here } CSmlView::~CSmlView() { } BOOL CSmlView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CView::PreCreateWindow(cs); } ///////////////////////////////////////////////////////////////////////////// // CSmlView drawing void CSmlView::OnDraw(CDC* pDC) { CSmploadDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); } ///////////////////////////////////////////////////////////////////////////// // CSmlView diagnostics #ifdef _DEBUG void CSmlView::AssertValid() const { CView::AssertValid(); } void CSmlView::Dump(CDumpContext& dc) const { CView::Dump(dc); } CSmploadDoc* CSmlView::GetDocument() // non-debug version is inline { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSmploadDoc))); return (CSmploadDoc*)m_pDocument; } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CSmlView message handlers int CSmlView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CView::OnCreate(lpCreateStruct) == -1) return -1; m_LBitmapWnd.SetWndHandle (GetSafeHwnd()); CSmploadApp * theApp =(CSmploadApp*)AfxGetApp(); m_LBitmapWnd.SetFileName((L_TCHAR *) (LPCTSTR) theApp->m_strFileName); if(m_LBitmapWnd.Load(0)!=SUCCESS) { m_LBitmapWnd.DisplayErrorFromList(NULL); return -1; } return 0; } void CSmlView::OnAllErrors() { // TODO: Add your command handler code here LBase::DisplayErrorList(m_hWnd); } void CSmlView::OnUpdateAllErrors(CCmdUI* pCmdUI) { // TODO: Add your command update UI handler code here pCmdUI->Enable(LBase::GetErrorsNumber()); } void CSmlView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView) { // TODO: Add your specialized code here and/or call the base class if(bActivate==TRUE&&pActivateView==this) { if(m_LBitmapWnd.HandlePalette(WM_QUERYNEWPALETTE, 0, 0)==FALSE) m_LBitmapWnd.Repaint(); } CView::OnActivateView(bActivate, pActivateView, pDeactiveView); }