/*[]=====================================================================[]*/ /*[] LeadTools Run Time Library - Version 14 []*/ /*[] []*/ /*[] []*/ /*[] Copyright (c) 1991-2004 LEAD Technologies, Inc. []*/ /*[] All Rights Reserved. []*/ /*[]=====================================================================[]*/ /*------------------------------------------------------------------------- We have made the assumption that the user has the knowledge of programming in C and Windows. --------------------------------------------------------------------------*/ #include "ImgPF.h" L_TCHAR szFrameClass[] = TEXT("PFFrame"); L_TCHAR szChildClass[] = TEXT("PFImage"); L_TCHAR szProgressClass[] = TEXT("PFProg"); L_TCHAR szAppName[] = TEXT("PFDemo"); HMENU hMenuInitWindow, hMenuChildWindow; HMENU hMenuInit, hMenuChild; HWND hWndFrame, hWndClient; HINSTANCE hInst; /*====(WinMain)============================================================ Description: Main windows function required for all windows applications. Syntax : L_INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) Prototype : windows.h Parameters : hInstance Handle to current instance of application. hPrevInstance Handle to previous instance of application. lpstrCommandLine Pointer to the Command Line. nComShow Integer used in ShowWindow. Return Value: The return value the user specify in wParam when send WM_QUIT message, or the paramter in PostQuitMessage. ==========================================================================*/ L_INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, L_INT iCmdShow) { HACCEL hAccel; MSG uMessage; WNDCLASS wndclass; lstrcpy(strSection, TEXT("ImgPF Section")); lstrcpy(strStringItem, TEXT("ImgPF String Item")); uBlkClip = DEFAULT_BLACK_CLIP; uWhtClip = DEFAULT_WHITE_CLIP; memset(szDirectory, 0, 1024); hInst = hInstance; wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; wndclass.lpfnWndProc = FrameWndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = hInstance; wndclass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON)); wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); wndclass.hbrBackground = GetStockObject (GRAY_BRUSH); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = szFrameClass; if(!RegisterClass (&wndclass)) return 0; //register the Image child window class wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = ChildWndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = sizeof(HANDLE); wndclass.hInstance = hInstance; wndclass.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON)); wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); wndclass.hbrBackground = GetStockObject (GRAY_BRUSH); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = szChildClass; RegisterClass(&wndclass); wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = (WNDPROC) ProgressBarProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = hInst; wndclass.hIcon = NULL; wndclass.hCursor = LoadCursor (NULL, IDC_ARROW); wndclass.hbrBackground = GetStockObject (LTGRAY_BRUSH); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = szProgressClass; if (!RegisterClass (&wndclass)) return 0; hMenuInit = LoadMenu (hInstance, MAKEINTRESOURCE(IDR_MAINFRAME)); hMenuChild = LoadMenu (hInstance, MAKEINTRESOURCE(IDR_CHILDFRAME)); hMenuInitWindow = GetSubMenu(hMenuInit, INIT_MENU_POS); hMenuChildWindow = GetSubMenu(hMenuChild, CHILD_MENU_POS); //Create the frame window hAccel = LoadAccelerators(hInstance, szAppName); hWndFrame = CreateWindow(szFrameClass, TEXT("Image Processing Functions Demo"), WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, hMenuInit, hInstance, NULL); hWndClient = GetWindow(hWndFrame, GW_CHILD); SetWindowLong(hWndClient, GWL_EXSTYLE, WS_EX_CLIENTEDGE); ShowWindow(hWndFrame, /*iCmdShow*/ SW_MAXIMIZE); UpdateWindow(hWndFrame); while (GetMessage (&uMessage, NULL, 0, 0)) { if(!TranslateMDISysAccel (hWndClient, &uMessage) && !TranslateAccelerator (hWndFrame, hAccel, &uMessage)) { TranslateMessage(&uMessage); DispatchMessage(&uMessage); } } DestroyMenu(hMenuChild); return uMessage.wParam; }