/** * Program initialization. */ static int Init() { /* Load control cursors */ LoadControlCursors(); /* Register window classes */ if ( RegisterWindowClasses() == 0 ) { return 0; } /* Initialize common controls library */ InitCommonControlsEx( NULL); /* Initialize property list dll */ if ( InitPropertyListDll( GetModuleHandle(NULL)) == 0 ) { return 0; } /* Initialize TWC and creating main window */ if ( !twcInit() || !(twcCreateObject( &MainWnd, 1, HWND_DESKTOP)) ) { return 0; } hMainWnd = MainWnd.hwnd; /* Create property list */ if ( CreatePropList() == 0) { return 0; } /* Set status bar z-order(top) */ SetWindowPos( StatusBar.hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); /* Add toolbox and toolbar buttons */ AddToolboxButtons(Toolbox.hwnd); AddMainToolbarButtons(MainToolbar.hwnd); /* Show main window */ ShowWindow( hMainWnd, SW_SHOWMAXIMIZED); UpdateWindow( hMainWnd); twc_SetObjectsClientDataSize( sizeof( TWC_OBJECT_CLIENT_DATA)); actNewProject(); return 1; }
void WINAPI GetModuleInfo(ModuleInfo *info, ClientInfo *client_info) { int i; info->event_mask = EVENT_SERVERMSG | EVENT_COLORCHANGED | EVENT_FONTCHANGED | EVENT_USERACTION | EVENT_TEXTCOMMAND; info->priority = PRIORITY_NORMAL; info->module_id = MODULE_ID; cinfo = client_info; // Save client info for our use later exiting = False; RegisterWindowClasses(); for (i = 0; i < num_buttons; i++) { mail_buttons[i].hModule = hInst; ToolbarAddButton(&mail_buttons[i]); } }
bool FEditorEngine::Init() { guard; RegisterWindowClasses(); Instance = new FInstance( this ); Instance->Init(); RenderPlugin = new FPlugin(); RenderPlugin->LoadPlugin( GConfig->ReadString( L"RenderDevice" ) ); if (!RenderPlugin->LoadInterface()) { Logf( LOG_CRIT, L"Cannot load DeviceInterfacePtr() in render plugin '%s", RenderPlugin->GetFilepath() ); Throw( L"Cannot load DeviceInterfacePtr() in render plugin", true ); } Render = (FRenderDevice*)(RenderPlugin->GetInterface())(); Render->Init(); return true; unguard; }
/****************************************************************************** * int WinMain( * HINSTANCE hinstCurrent, * HINSTANCE hinstPrevious, * LPSTR lpszCmdLine, * int nCmdShow); * * windows initialization and exit * * parameters: * hinstCurrent - handle to this instance of minerva * hinstPrevious - handle to previous instance of minerva. If hinstPrevious is * NULL, no other instance is active (this is the first and only instance). * lpszCmdLine - command line parameters to this instance * nCmdShow - see ShowWindow() documentation * * returns: * value to be set as exit code for application * * notes: * WinMain is called as the application is starting up. When WinMain returns, * the application is terminated. ******************************************************************************/ int PASCAL WinMain( HINSTANCE hinstCurrent, /* handle to this instance */ HINSTANCE hinstPrevious, /* handle to previous instance or NULL */ LPSTR lpszCmdLine, /* command line */ int nCmdShow) /* see ShowWindow() documentation */ { MSG msg; LPCSTR psz; NOREFERENCE(lpszCmdLine); /* make SURE that (LPBITMAPINFO)&PIC_PARM.Head is valid */ assert(offsetof(PIC_PARM, ColorTable) - offsetof(PIC_PARM, Head) == offsetof(BITMAPINFO, bmiColors) - offsetof(BITMAPINFO, bmiHeader)); hinstThis = hinstCurrent; /* instance handle is globally accessible */ /* allow ctl3d to hook us */ Ctl3dRegister(hinstThis); /* dialogs and controls are automatically 3d */ Ctl3dAutoSubclass(hinstThis); if ( hinstPrevious == NULL ) { /* register window classes for first instance only hinstPrevious == NULL if and only if this is the only active instance of minerva */ if ( !RegisterWindowClasses() ) { Ctl3dUnregister(hinstCurrent); return ( 0 ); } } /* keyboard accelerators for menu commands */ hAcceleratorTable = LoadAccelerators(hinstThis, "MinervaAccelerators"); if ( hAcceleratorTable == NULL ) { ErrorMessage(STYLE_FATAL, IDS_LOADACCELERATORS); /* "An unexpected LoadAccelerators error occurred. Minerva cannot continue." */ Ctl3dUnregister(hinstCurrent); return ( 0 ); } if ( !CreateFrameWindow(nCmdShow) ) { Ctl3dUnregister(hinstCurrent); return ( 0 ); } /* load MRU file list from minerva.ini and update File menu */ if ( !MruLoadList(hwndFrame, APPLICATION_INIFILENAME) ) { DestroyWindow(hwndFrame); Ctl3dUnregister(hinstCurrent); return ( 0 ); } hWaitCursor = LoadCursor(NULL, IDC_WAIT); hArrowCursor = LoadCursor(NULL, IDC_ARROW); hHandCursor = LoadCursor(hinstThis, MAKEINTRESOURCE(IDC_HAND)); assert(hWaitCursor != NULL && hArrowCursor != NULL && hHandCursor != NULL); /* load PIC opcode DLL's */ InitOpList(); bDisableRDTSC = GetPrivateProfileInt("Settings", "DisableRDTSC", 0, APPLICATION_INIFILENAME); psz = lpszCmdLine + _fstrspn(lpszCmdLine, " "); while ( psz != 0 && ( *psz == '-' || *psz == '/' || *psz == '+' ) ) { if ( _fstrnicmp(psz + 1, "RDTSC", sizeof("RDTSC") - 1) == 0 && psz[sizeof("RDTSC")] <= ' ' ) bDisableRDTSC = *psz != '+'; psz = _fstrpbrk(psz, " "); if ( psz != 0 ) psz += _fstrspn(psz, " "); } if ( !bDisableRDTSC ) MiscTickCount(); // calibrate the RDTSC ticks while ( GetMessage(&msg, NULL, 0, 0) ) { if ( !TranslateMDISysAccel(hwndMDIClient, &msg) && !TranslateAccelerator(hwndFrame, hAcceleratorTable, &msg) ) { TranslateMessage(&msg); DispatchMessage(&msg); } } DestroyCursor(hHandCursor); /* unload PIC opcode DLL's */ CleanupOpList(); /* save MRU file list to minerva.ini */ MruSaveList(APPLICATION_INIFILENAME); Ctl3dUnregister(hinstCurrent); return ( msg.wParam ); }
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow) { MSG msg; WINDOWPLACEMENT w; BOOL bQuit = FALSE; InitCommonControls(); hInst = hInstance; // Find location of configuration file ConfigInit(); /* Register our custom classes */ RegisterWindowClasses(); hMain = CreateWindow(szAppName, /* window class name */ szAppName, /* window caption */ WS_OVERLAPPEDWINDOW, /* window style */ 0, 0, 0, 0, /* initially zero size; changed below */ NULL, /* parent window handle */ NULL, /* window menu handle */ hInstance, /* program instance handle */ NULL); /* creation parameters */ if (!hMain) { char buf[256]; DWORD err = GetLastError(); sprintf(buf, "Error - Couldn't Create Client Window : %d", err); MessageBox(NULL, buf, "ERROR!", MB_OK); MainQuit(hMain); exit(1); } if (config.debug) CreateDebugWindow(); if (lpszCmdParam && strlen(lpszCmdParam) > 0) ConfigOverride(lpszCmdParam); w.length = sizeof(WINDOWPLACEMENT); WindowSettingsLoad(&w); SetWindowPlacement(hMain, &w); D3DRenderInit(hMain); ModulesInit(); // Set up data structures for modules /* attempt make a crc16 on the meridian.exe */ GenerateCRC16(); MainInitState(STATE_OFFLINE); UpdateWindow(hMain); while (!bQuit) { MainIdle(); while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { if (!GetMessage(&msg, NULL, 0, 0)) { bQuit = TRUE; break; } // Forward appropriate messages for tooltips if (state == STATE_GAME) TooltipForwardMessage(&msg); /* Handle modeless dialog messages separately */ if ((hCurrentDlg == NULL || !IsDialogMessage(hCurrentDlg, &msg))) { TranslateMessage(&msg); DispatchMessage(&msg); } } } /* Unregister our custom classes--not good to leave them around */ UnregisterWindowClasses(); return msg.wParam; // Return value of PostQuitMessage }
// // Initialize // bool wxApp::Initialize(int& argc, wxChar **argv) { if ( !wxAppBase::Initialize(argc, argv) ) return false; #if defined(wxUSE_CONSOLEDEBUG) #if wxUSE_CONSOLEDEBUG /***********************************************/ /* Code for using stdout debug */ /* To use it you mast link app as "Window" - EK*/ /***********************************************/ { PPIB pib; PTIB tib; printf("In console\n"); DosGetInfoBlocks(&tib, &pib); /* Try morphing into a PM application. */ // if(pib->pib_ultype == 2) /* VIO */ pib->pib_ultype = 3; } /**********************************************/ /**********************************************/ #endif //wxUSE_CONSOLEDEBUG #endif // // OS2 has to have an anchorblock // vHabmain = WinInitialize(0); wxFileName GetPrefix(argv[0]); GetPrefix.MakeAbsolute(); wxStandardPaths::SetInstallPrefix(GetPrefix.GetPath()); if (!vHabmain) { // TODO: at least give some error message here... wxAppBase::CleanUp(); return false; } wxBuffer = new wxChar[1500]; // FIXME; why? // Some people may wish to use this, but // probably it shouldn't be here by default. #ifdef __WXDEBUG__ // wxRedirectIOToConsole(); #endif wxWinHandleHash = new wxWinHashTable(wxKEY_INTEGER, 100); // This is to foil optimizations in Visual C++ that throw out dummy.obj. // PLEASE DO NOT ALTER THIS. #if !defined(WXMAKINGDLL) && defined(__VISAGECPP__) extern char wxDummyChar; if (wxDummyChar) wxDummyChar++; #endif // wxSetKeyboardHook(TRUE); RegisterWindowClasses(vHabmain); return true; } // end of wxApp::Initialize