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