int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MainInitialize("��o�ۑ�"); MainLoop(); MainFinalize(); return 0; }
int WINAPI wWinMain( IN HINSTANCE Instance, IN HINSTANCE Previous, IN PWSTR CommandLine, IN int nCmdShow ) { ULONG Status; USHORT Length; WCHAR Buffer[MAX_PATH]; WCHAR FilterPath[MAX_PATH]; WCHAR CachePath[MAX_PATH]; if (ParseCommandLine(Buffer) != TRUE) { return FALSE; } Status = SdkInitialize(Instance); if (Status != S_OK) { return 0; } Status = BspInitialize(); if (Status != S_OK) { return 0; } // // First try to load mdb, if failed, rebuild // the mdb using default value // Status = MdbInitialize(TRUE); if (Status != S_OK) { Status = MdbInitialize(FALSE); if (Status != S_OK) { return Status; } BspWriteLogEntry(LOG_LEVEL_WARNING, LOG_SOURCE_MDB, L"Mdb may be corrupted, succeed to rebuild default values."); } // // Ensure the user accept EULA // Status = MdbEnsureEula(); if (Status != S_OK) { return Status; } // // N.B. Kernel driver should be checked against MDB // #ifdef _KBTR #pragma message("kernel driver is enabled.") Status = BspConnectDriver(BTR_DRIVER_NAME, BTR_DOSDEVICE_NAME, &BspDriverHandle); #endif BspGetFullPathName(L"dprobe.btr.dll", Buffer, MAX_PATH, &Length); BspGetProcessPath(FilterPath, MAX_PATH, &Length); MdbGetCachePath(CachePath, MAX_PATH); Status = MspInitialize(MSP_MODE_DLL, MSP_FLAG_LOGGING, L"dprobe.btr.dll", Buffer, FeatureRemote, FilterPath, CachePath); if (Status != S_OK) { return 0; } Status = PerfInitialize(NULL); if (Status != S_OK) { return 0; } Status = MainInitialize(); if (!Status) { return 0; } MainMessagePump(); return 0; }
int WINAPI WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow ) { SpaceballControlStruct scs; SpaceballAppDataStruct app; PointStr World[2]; char fname[256]; float CTM[4][4]; /* Current transformation matrix */ SiSpwHandlers DspHandlers; LONG addr = (long)&scs; HWND wndScreen; RECT screenRect; int size; DWORD dSizeNeeded; char appDir[256]; //int ssize; //char DirName[256]; ncmdshow = nCmdShow; //FILE *fp; /* * Figure out how big the screen is so that we can make our * window an appropriate size. */ wndScreen = GetDesktopWindow(); GetWindowRect ( wndScreen, &screenRect ); size = (int)(.8 * SPW_MIN( (screenRect.bottom - screenRect.top), (screenRect.right - screenRect.left) )); Spw_WindowWidth = size; Spw_WindowHeight = size; /* Add code to parse command line for alternate file --here-- */ /* Code that finds the default data file in its usual spot */ // if (0 != (dSizeNeeded = GetCurrentDirectory(256, appDir))) if (0 != (dSizeNeeded = GetModuleFileName(NULL, appDir, 256 ))) { char widgetUStr[] = "WIDGET\0"; char widgetLStr[] = "widget\0"; char DirName[256]; char *pdest; int result; FILE *fp; /* find "widget" in directory string */ pdest = strstr( appDir, widgetUStr ); if (pdest == NULL) { pdest = strstr( appDir, widgetLStr ); } if (pdest != NULL) { /* get the index of the end of "widget" */ result = pdest - appDir + strlen(widgetUStr); /* snip everything after "widget" */ appDir[result] = '\0'; /* build the file name */ strcpy(DirName, appDir); strcat(DirName, "\\dat\\widget.dat"); } /* see if we can open the file */ if (NULL != (fp=fopen(DirName, "r"))) { fclose(fp); /* close it back up */ strcpy(fname, DirName); /* save the file name */ } else /* file is in a non standard location; let user find it */ { strcpy(fname, "*.dat"); GetNTFileName( NULL, fname ); } } /* * Initialize the Spaceball data structures */ /* Spaceball tuning values */ scs.sbScaleFactor[0] = (float)0.05; scs.sbScaleFactor[1] = (float)0.05; scs.sbScaleFactor[2] = (float)0.005; scs.sbScaleFactor[3] = (float)0.0005; scs.sbScaleFactor[4] = (float)0.0005; scs.sbScaleFactor[5] = (float)0.0005; /* Initialize platform-independent data */ MainInitialize (fname, &scs, &app, (float *)CTM, World); MoveWindow(hWndMain, 300, 0, Spw_WindowWidth, Spw_WindowHeight, TRUE); SetClassLong(hWndMain, 0, (LONG)(&scs)); /* * Initialize the Spaceball, render initial scene */ InitializeSpaceball(0, hWndMain, &DspHandlers, &scs); ResetWidgetView( (float(*)[4])app.CTM, app.center ); app.redraw = TRUE; InvalidateRect(hWndMain, NULL, FALSE); return(DispatchLoopNT(&DspHandlers)); } /* end of WinMain */