--- /dev/null
+///////////////////////////////////////\r
+// main.cpp\r
+\r
+#include "SimpleApp.h"\r
+#include "resource.h"\r
+\r
+\r
+INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR, int)\r
+{\r
+ TCHAR szBuf[MAX_STRING_SIZE];\r
+ ::LoadString(hInstance, IDW_MAIN, szBuf, MAX_STRING_SIZE -1);\r
+ HWND hWnd = FindWindow(szBuf, NULL);\r
+\r
+ // If application is already running, restore it and quit\r
+ if (hWnd)\r
+ {\r
+ SetForegroundWindow ((HWND)(((DWORD)hWnd) | 0x01));\r
+ TRACE(_T("Application Already running"));\r
+ return -1;\r
+ }\r
+\r
+ //Start the framework\r
+ CSimpleApp MyApp;\r
+\r
+ //Process the window messages\r
+ return MyApp.Run();\r
+}\r