XERCES_CPP_NAMESPACE_USE // ---------------------------------------------------------------------------- // WinMain // // Windows equivalent of main. // ---------------------------------------------------------------------------- INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow) { // the message thats collected and dispatched MSG Msg; // the name of the class to build a window char *ClsName = "Main window class"; // the name printed on an individual window char *WndName = "Mamoview"; CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); // Some code thats necessary to initialise gdi, don;t know how it // works must just call some things in the dll Gdiplus::GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); try { XMLPlatformUtils::Initialize(); } catch (const XMLException& toCatch) { // Do your failure processing here return 1; } // Do your actual work with Xerces-C++ here. // Declare and initialize the application class, which contains data needed // to make a window in the first place WApplication WinApp(hInstance, ClsName, WndProc, IDR_MENU1); WinApp.Register(); // // Declare a MainWnd object which represents what is seen graphically // and then create it MainWnd Wnd; /*HWND Create(HINSTANCE hinst, // application instance LPCTSTR clsname, // the name of the window class LPCTSTR wndname, // the name of the window HWND parent = NULL, // the parent window reference DWORD dStyle = WS_OVERLAPPEDWINDOW, // the window style DWORD dXStyle = 0, // extended window style int x = 10, // x position of the window int y = 10, // y position of the window int width = 300, // width of the window int height = 300); // height of the window*/ Wnd.Create(hInstance, ClsName, WndName, NULL, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,WS_EX_LAYERED | WS_EX_OVERLAPPEDWINDOW ); // Display the main window Wnd.Show(); //prepareGraphics(); // Process the main window's messages while( GetMessage(&Msg, NULL, 0, 0) ) { // convert virtual key messages to character ones and put back into message queue TranslateMessage(&Msg); // send to window procedure, of which there might be a few in 1 app DispatchMessage(&Msg); } Gdiplus::GdiplusShutdown(gdiplusToken); XMLPlatformUtils::Terminate(); return 0; } // --- WinMain --------------------------------------------------------------
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPTSTR lpCmdLine, _In_ int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); MSG msg; HACCEL hAccelTable; WNDCLASSEX wcex; #ifdef _DEBUG INIT_CRT_DEBUG_REPORT(); //_CrtSetBreakAlloc(290); #endif wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = MainWnd::WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wcex.lpszMenuName = MAKEINTRESOURCE(IDC_APIGATE); wcex.lpszClassName = MainWnd::szClassName; wcex.hIconSm = wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APIGATE)); if (!RegisterClassEx(&wcex)) { return -1; } g_hInstance = hInstance; //if (!AfxWinInit(hInstance, hPrevInstance, lpCmdLine, nCmdShow)) // TRACE("AfxWinInit failed.\n"); s_hRichEdit = LoadLibrary(_T("RICHED20.DLL")); INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); // if (!AfxInitRichEdit2()) // TRACE("AfxInitRichEdit failed.\n"); g_api = new ApiMan(); g_svr = new SvrMan(); if (!g_mainwnd.Create(nCmdShow)) { goto _finish; } hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_APIGATE)); while (GetMessage(&msg, NULL, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } _finish: g_mainwnd.Destroy(); delete g_svr; delete g_api; FreeLibrary(s_hRichEdit); UnregisterClass(MainWnd::szClassName, hInstance); return 0;// (int)msg.wParam; }