void WR_EXPORT WRCtl3DFini( HINSTANCE inst ) { _wtouch( inst ); #if defined( WR_USE_3D ) Ctl3dUnregister( inst ); #endif WRCtl3DDLLFini(); }
/****************************************************************************** * 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 ); }
BOOL _DLLFAR _CB_Ctl3dUnregister( HANDLE h ) { return( Ctl3dUnregister( h ) ); }
int PEXPORT WinMain(HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpszCmdLine, int cmdShow) { BOOL bMulti, bRes; hPrevKappa = hPrevInstance; while (lpszCmdLine[0] && isspace(lpszCmdLine[0])) lpszCmdLine++; #ifdef LIMITED bMulti = FALSE; #else bMulti = _fstrncmp(lpszCmdLine, "-s", 2); #endif LoadString(hInstance, IDS_APPNAME, szAppName, 10); LoadString(hInstance, IDS_TITLE, szTitle, 50); #ifndef LIMITED if (!bMulti) lpszCmdLine += 2; #endif if (hPrevInstance) bMulti = KppIsMultiEnabled(); if (!bMulti && hPrevInstance) { HWND hPrevWnd = FindWindow(szAppName, szTitle); if (hPrevWnd) { ShowWindow(hPrevWnd, SW_SHOWNORMAL); BringWindowToTop(hPrevWnd); } return FALSE; } #ifdef MULTI KppInitDLLDataSegs(bMulti); #endif if (!KappaInit(KERNEL, hInstance, hPrevInstance, lpszCmdLine, cmdShow, bMulti)) return FALSE; bRes = KappaLoad(DEVELOP, lpszCmdLine, cmdShow, bMulti); #ifdef CTL3D if (Kpp3dCtrls()) Ctl3dUnregister(hInstKappa); #endif #ifdef MULTI KppTermDLLDataSegs(bMulti); #endif if (dwDDEInst) DdeUninitialize(dwDDEInst); return bRes; }