2 * psychlops_app_main_Win32.h
\r
3 * Psychlops Standard Library (Win32)
\r
5 * Last Modified 2006/01/09 by Kenchi HOSOKAWA
\r
6 * (C) 2006 Kenchi HOSOKAWA, Kazushi MARUYA and Takao SATO
\r
10 #ifndef HEADER_PSYCHLOPS_APP_MAIN_WIN32
\r
11 #define HEADER_PSYCHLOPS_APP_MAIN_WIN32
\r
14 #include <windows.h>
\r
15 #include "../../psychlops_lib.h"
16 #include "../../core/ApplicationInterfaces/psychlops_app_init.h"
17 #include "psychlops_app_state_Win32.h"
22 void psychlops_main();
\r
24 namespace Psychlops {
\r
27 } /* <- namespace Psycholops */
\r
30 extern "C" int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow) {
34 Psychlops::APIApplicationProperties::startupinfo.set(hInstance, hPrevInstance, lpCmdLine, iCmdShow);
39 //HANDLE h = CreateFile(CreateFile("\\\\.\\giveio", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
\r
40 //if(h == INVALID_HANDLE_VALUE) throw "INVALID_HANDLE_VALUE";
\r
43 HANDLE hProcess = GetCurrentProcess();
\r
44 SetPriorityClass(hProcess,NORMAL_PRIORITY_CLASS);
\r
46 Psychlops::initialize();
\r
48 std::string src(GetCommandLine());
\r
49 std::string::size_type start = 0;
\r
51 std::string::size_type end = src.find(" ", start);
\r
52 if(end != std::string::npos){
\r
54 Psychlops::AppInfo::args.push_back(src.substr(start, end - start));
\r
56 Psychlops::AppInfo::args.push_back(src.substr(start, src.length() - start));
\r
63 Psychlops::finalize();
66 } catch(Psychlops::Exception e) {
\r
67 // if(e.ti_ == typeid(Psychlops::APIInputProperties)) {
\r
68 // if(Psychlops::Display::the_canvas!=NULL) Psychlops::Display::the_canvas->release();
\r
70 MessageBox( NULL, e.to_s().c_str(), "Psychlops Notification", MB_OK );
\r
71 //Psychlops::APIApplicationProperties::analyzeAPIError();
\r
72 } catch(Psychlops::Exception *e) {
73 MessageBox( NULL, e->to_s().c_str(), "Psychlops Notification", MB_OK );
74 } catch(std::exception e) {
\r
75 MessageBox( NULL, e.what(), "Psychlops Notification : std lib exception", MB_OK );
\r
76 } catch(char* str) {
\r
77 MessageBox( NULL, str, "Psychlops Notification", MB_OK );
\r
78 //Psychlops::APIApplicationProperties::analyzeAPIError();
\r
86 //DWORD WINAPI entryMainThread(LPVOID vdParam);
\r