Window::Window(HINSTANCE instance, const Description& description) : m_instance(instance) , m_handle(NULL) , m_exitValue(0) { if (!SetupClass(description)) throw r2ExceptionRuntimeM("Failed to setup window class"); if (!SetupWindow(description)) throw r2ExceptionRuntimeM("Failed to create window"); }
PClass *ClassReg::RegisterClass() { // Skip classes that have already been registered if (MyClass != nullptr) { return MyClass; } // Add type to list PClass *cls = new PClass; SetupClass(cls); cls->InsertIntoHash(true); if (ParentType != nullptr) { cls->ParentClass = ParentType->RegisterClass(); } return cls; }
int GUIXMain( int argc, char *argv[] ) { bool ok; int ret; bool register_done; HAB inst; inst = WinInitialize( 0 ); if( !inst ) { return( 0 ); } GUIPMmq = WinCreateMsgQueue( inst, 0 ); if( !GUIPMmq ) { return( 0 ); } register_done = FALSE; #else int GUIXMain( int argc, char *argv[], WPI_INST inst, WPI_INST hPrevInstance, LPSTR lpCmdLine, int nShowCmd ) { bool ok; int ret; bool register_done; ret = 0; lpCmdLine = lpCmdLine; nShowCmd = nShowCmd; register_done = ( hPrevInstance != 0 ); FirstInstance = ( hPrevInstance == 0 ); #endif GUIMainTouched = TRUE; GUIStoreArgs( argv, argc ); _wpi_setwpiinst( inst, 0, &GUIMainHInst ); memcpy( &GUIResHInst, &GUIMainHInst, sizeof( WPI_INST ) ) ; ok = TRUE; GUISetWindowClassName(); GUIMemOpen(); ok = GUIFirstCrack(); if( ok ) { if( !register_done ) { ok = SetupClass(); } } if( ok ) { ok = GUILoadStrInit( argv[0] ); } if( ok ) { ok = GUIInitInternalStringTable(); } if( ok ) { GUIInitGUIMenuHint(); GUImain(); } if( GUIGetFront() == NULL && !Posted ) { /* no windows created */ _wpi_postquitmessage( 0 ); } if( NumWindows ) { ret = GUIWinMessageLoop(); } #ifdef __OS2_PM__ WinDestroyMsgQueue( GUIPMmq ); WinTerminate( inst ); #endif GUICleanup(); GUIDead(); GUIMemClose(); return( ret ); }