/*[]=====================================================================[]*/ /*[] LeadTools Run Time Library - Version 13 []*/ /*[] []*/ /*[] []*/ /*[] Copyright (c) 1991-2001 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("RgnFrame"); L_TCHAR szChildClass[] = TEXT("RgnImage"); L_TCHAR szAppName[] = TEXT("RgnDemo"); HMENU hMenuInitWindow, hMenuChildWindow; HMENU hMenuInit, hMenuChild,hMenuDisChild; 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, int iCmdShow) { HACCEL hAccel ; MSG msg; WNDCLASS wndclass; uBlkClip = DEFAULT_BLACK_CLIP; uWhtClip = DEFAULT_WHITE_CLIP; 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); hMenuInit = LoadMenu (hInstance, MAKEINTRESOURCE(IDR_MAINFRAME)); hMenuChild = LoadMenu (hInstance, MAKEINTRESOURCE(IDR_CHILDFRAME)); hMenuDisChild = LoadMenu (hInstance, MAKEINTRESOURCE(IDR_DISABLED)); hMenuInitWindow = GetSubMenu(hMenuInit, INIT_MENU_POS); hMenuChildWindow = GetSubMenu(hMenuChild, CHILD_MENU_POS); //Create the frame window hAccel = LoadAccelerators(hInstance,szAppName); hWndFrame = CreateWindow(szFrameClass, TEXT("Registration Marks Demo"), WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, hMenuInit, hInstance, NULL); hWndClient = GetWindow(hWndFrame,GW_CHILD); ShowWindow(hWndFrame, iCmdShow); UpdateWindow(hWndFrame); while (GetMessage (&msg,NULL,0,0)) { if(!TranslateMDISysAccel (hWndClient,&msg) && !TranslateAccelerator (hWndFrame,hAccel, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } DestroyMenu(hMenuChild); DestroyMenu(hMenuDisChild); return msg.wParam; }