1 // SimanticsExcel.cpp : Defines the entry point for the application.
\r
5 #include "SimanticsExcel.h"
\r
7 #define MAX_LOADSTRING 100
\r
10 HINSTANCE hInst; // current instance
\r
11 TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
\r
12 TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
\r
14 // Forward declarations of functions included in this code module:
\r
15 ATOM MyRegisterClass(HINSTANCE hInstance);
\r
16 BOOL InitInstance(HINSTANCE, int);
\r
17 LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
\r
18 INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
\r
20 int APIENTRY _tWinMain(HINSTANCE hInstance,
\r
21 HINSTANCE hPrevInstance,
\r
25 UNREFERENCED_PARAMETER(hPrevInstance);
\r
26 UNREFERENCED_PARAMETER(lpCmdLine);
\r
28 // TODO: Place code here.
\r
32 // Initialize global strings
\r
33 LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
\r
34 LoadString(hInstance, IDC_SIMANTICSEXCEL, szWindowClass, MAX_LOADSTRING);
\r
35 MyRegisterClass(hInstance);
\r
37 // Perform application initialization:
\r
38 if (!InitInstance (hInstance, nCmdShow))
\r
43 hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_SIMANTICSEXCEL));
\r
45 // Main message loop:
\r
46 while (GetMessage(&msg, NULL, 0, 0))
\r
48 if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
\r
50 TranslateMessage(&msg);
\r
51 DispatchMessage(&msg);
\r
55 return (int) msg.wParam;
\r
61 // FUNCTION: MyRegisterClass()
\r
63 // PURPOSE: Registers the window class.
\r
67 // This function and its usage are only necessary if you want this code
\r
68 // to be compatible with Win32 systems prior to the 'RegisterClassEx'
\r
69 // function that was added to Windows 95. It is important to call this function
\r
70 // so that the application will get 'well formed' small icons associated
\r
73 ATOM MyRegisterClass(HINSTANCE hInstance)
\r
77 wcex.cbSize = sizeof(WNDCLASSEX);
\r
79 wcex.style = CS_HREDRAW | CS_VREDRAW;
\r
80 wcex.lpfnWndProc = WndProc;
\r
81 wcex.cbClsExtra = 0;
\r
82 wcex.cbWndExtra = 0;
\r
83 wcex.hInstance = hInstance;
\r
84 wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SIMANTICSEXCEL));
\r
85 wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
\r
86 wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
\r
87 wcex.lpszMenuName = MAKEINTRESOURCE(IDC_SIMANTICSEXCEL);
\r
88 wcex.lpszClassName = szWindowClass;
\r
89 wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
\r
91 return RegisterClassEx(&wcex);
\r
95 // FUNCTION: InitInstance(HINSTANCE, int)
\r
97 // PURPOSE: Saves instance handle and creates main window
\r
101 // In this function, we save the instance handle in a global variable and
\r
102 // create and display the main program window.
\r
104 BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
\r
108 hInst = hInstance; // Store instance handle in our global variable
\r
110 hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
\r
111 CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
\r
118 ShowWindow(hWnd, nCmdShow);
\r
119 UpdateWindow(hWnd);
\r
125 // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
\r
127 // PURPOSE: Processes messages for the main window.
\r
129 // WM_COMMAND - process the application menu
\r
130 // WM_PAINT - Paint the main window
\r
131 // WM_DESTROY - post a quit message and return
\r
134 LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
\r
143 wmId = LOWORD(wParam);
\r
144 wmEvent = HIWORD(wParam);
\r
145 // Parse the menu selections:
\r
149 DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
\r
152 DestroyWindow(hWnd);
\r
155 return DefWindowProc(hWnd, message, wParam, lParam);
\r
159 hdc = BeginPaint(hWnd, &ps);
\r
160 // TODO: Add any drawing code here...
\r
161 EndPaint(hWnd, &ps);
\r
164 PostQuitMessage(0);
\r
167 return DefWindowProc(hWnd, message, wParam, lParam);
\r
172 // Message handler for about box.
\r
173 INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
\r
175 UNREFERENCED_PARAMETER(lParam);
\r
178 case WM_INITDIALOG:
\r
179 return (INT_PTR)TRUE;
\r
182 if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
\r
184 EndDialog(hDlg, LOWORD(wParam));
\r
185 return (INT_PTR)TRUE;
\r
189 return (INT_PTR)FALSE;
\r