/*[]=====================================================================[]*/ /*[] LEADTOOLS for Windows(Class Library) - Version 11 []*/ /*[] []*/ /*[] []*/ /*[] Copyright (c) 1991-2000 LEAD Technologies, Inc. []*/ /*[] All Rights Reserved. []*/ /*[]=====================================================================[]*/ /*---(Info)---------------------------------------------------------------- We have made the assumption that the user has the knowledge of Object Oriented programing of C under Windows. This example will: 1. display vital image information from a file whose name is sent through the command line, and version information about the LEAD DLL in use. Usage: INFO --------------------------------------------------------------------------*/ // info.cpp : Defines the class behaviors for the application. // #include "stdafx.h" #include "info.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CInfoApp BEGIN_MESSAGE_MAP(CInfoApp, CWinApp) //{{AFX_MSG_MAP(CInfoApp) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG ON_COMMAND(ID_HELP, CWinApp::OnHelp) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CInfoApp construction CInfoApp::CInfoApp() { LBase::LoadLibraries ( LT_KRN | LT_DIS | LT_FIL | LT_IMG ); WRPUNLOCKSUPPORT(); } ///////////////////////////////////////////////////////////////////////////// // The one and only CInfoApp object CInfoApp theApp; ///////////////////////////////////////////////////////////////////////////// // CInfoApp initialization BOOL CInfoApp::InitInstance() { if (m_lpCmdLine[0] == TEXT('\0')) { ::MessageBox(NULL, TEXT("No file was provided!"), TEXT("Error"), MB_OK | MB_ICONERROR); return FALSE; } DiplayInfo((L_TCHAR *) m_lpCmdLine); LBase::UnloadLibraries(LT_KRN | LT_DIS | LT_FIL | LT_IMG); return FALSE; } L_VOID CInfoApp::DiplayInfo(L_TCHAR * szFileName) { // TODO: Add your specialized creation code here L_INT nRet; LFile LeadFile; FILEINFO FileInfo; /* LEAD File Information structure. */ VERSIONINFO VersionInfo; /* LEAD Version Information structure. */ L_TCHAR Buf[1024]; /* Buffer to hold information for display. */ LeadFile.SetFileName(szFileName); FileInfo.uStructSize = sizeof(FILEINFO); nRet = LeadFile.GetInfo( &FileInfo, sizeof(FILEINFO) ) ; if (nRet != SUCCESS) { wsprintf (Buf, _T("Error %d obtaining information on the file %s"), nRet, szFileName); MessageBox (NULL,Buf,_T("ERROR"),MB_OK|MB_APPLMODAL); return ; } wsprintf (Buf, _T("FileName: %s\n\n") _T("Format: %d\n\n") _T("Width: %d\n\n") _T("Height: %d\n\n") _T("BitsPerPixel: %d\n\n") _T("ViewPerspective: %d\n\n") _T("Size On Disk: %ld\n\n") _T("Size In Memory: %ld\n\n") _T("Compression: %s"), szFileName, FileInfo.Format, FileInfo.Width, FileInfo.Height, FileInfo.BitsPerPixel, FileInfo.ViewPerspective, FileInfo.SizeDisk, FileInfo.SizeMem, FileInfo.Compression); MessageBox (NULL, Buf, _T("File Information"), MB_OK | MB_APPLMODAL); LBase::VersionInfo(&VersionInfo, sizeof(VERSIONINFO)); wsprintf (Buf, _T("LEAD Product: %hs, %s\n\n") _T("Version %d.%d\n\n") _T("Date: %hs\n\n") _T("Time: %hs"), VersionInfo.Product, ((VersionInfo.Level==TOOLKIT_LEVEL_MEDICAL) ? _T("Medical Editions") : (VersionInfo.Level==TOOLKIT_LEVEL_DOCUMENT)? _T("Express Editions "): _T("Professional Edition")), VersionInfo.MajorNumber, VersionInfo.MinorNumber, VersionInfo.Date, VersionInfo.Time); MessageBox (NULL, Buf, _T("DLL Version Information"), MB_OK | MB_APPLMODAL); }