int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE PrevInstance, PSTR cmdLine, int showCmd) { if(!InitD3D(hInstance, Width, Height, Windowed, D3DDEVTYPE_HAL, &Device)) { ::MessageBox(0, "InitD3D Failed", "Error", MB_OK); return 0; } if(!Setup()) { ::MessageBox(0, "Setup Failed", "Error", MB_OK); return 0; } EnterMsgLoop( Display ); Cleanup(); Device->Release(); return 0; }
//--- Application entry point. //--- calls the framework functions. //--- Sets up Directsound. int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE prevInstance, PSTR cmdLine, int showCmd) { HWND hwnd; // handle to window created. float a = 0; while( a < 360) { float radVal = a * ( M_PI / 180); float check = sinf(radVal); a++; int x = 0; } if (!InitWindow ( "Allan Milne's Moving Car In A Straight Line", // window title text. hinstance, 800, 600, true, &hwnd)) // returns window handle. { MessageBox(0, "InitWindow() - FAILED", 0, 0); return 0; } //--- Initialise DirecSound. dsDevice = new DSoundDevice(); if (!dsDevice->Initialize (hwnd, DSSCL_PRIORITY)) { MessageBox(0, "DSoundDevice::Initialize() - FAILED", 0, 0); return 0; } //--- call the setup function and test if it worked. if(!Setup()) { MessageBox(0, "Setup() - FAILED", 0, 0); return 0; } //--- set up the 'process' function as the message loop handler. EnterMsgLoop (Process); //--- do any cleaning up of resources before end of app. Cleanup(); //--- clean-up DirectSound device. free (dsDevice); // implicitly calss destructor method. return 0; }
//--- WinMain int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE prevInstance, PSTR cmdLine, int showCmd) { HWND hwnd; // Create window if (!InitWindow ("PlaySound.cpp", hinstance, 800, 600, false, &hwnd)) { MessageBox(0, "InitWindow() - FAILED", 0, 0); return 0; } //--- Initialise DirecSound. dsDevice = new DSoundDevice(); if (!dsDevice->Initialize (hwnd, DSSCL_NORMAL)) { MessageBox(0, "DSoundDevice::Initialize() - FAILED", 0, 0); return 0; } // Create sound if(!Setup()) { MessageBox(0, "Setup() - FAILED", 0, 0); return 0; } // Check for windows messages EnterMsgLoop (Process); // Release the sound Cleanup(); // Free up the device free (dsDevice); return 0; }
int __stdcall WinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nShowCmd) { // 初始化Instance,创建窗口,初始化d3d工作 HRESULT hr = 0; hr = InitInstance(hInstance, g_WndWidth, g_WndHeight, true, false, g_DevType, &g_pDevice); if (FAILED(hr)) { MessageBox(0, "Faile to init instance!", 0, 0); return 0 ; } // 保存窗口句柄 g_hWnd = GetActiveWindow(); if (!g_hWnd) { MessageBox(0, "Failed to get windows handle!", 0, 0); return 0; } // 游戏设置 hr = SetUp(); if (FAILED(hr)) goto Clean; // 加载游戏内容 hr = LoadContent(); if (FAILED(hr)) goto UnLoad; // 游戏循环 EnterMsgLoop(); // 卸载游戏内容 UnLoad: UnLoadContent(); // 清除 Clean: CleanUp(); return 0; }
INT WINAPI WinMain(HINSTANCE hInstance, // Instancia a nuestra aplicación HINSTANCE hPrevInstance, // Existen instancias previas de nuestra aplicación? LPSTR lpCmdLine, // Línea de comandos int nShowCmd) // Cómo se despliega nuestra ventana? { if(!SUCCEEDED(IniVentana(hInstance))) return 0; // Mostrar nuestra ventana ShowWindow(main_hWnd, nShowCmd); UpdateWindow(main_hWnd); InitializeAll(main_hWnd); EnterMsgLoop( Display ); Device->Release(); UnregisterClass("Math tests",hInstance); return 0; }
void xtyMsgServerLoopJob::RunJobRoutine(void* pContext) { // pass 'm_pMsgServer' as 'pContext' to the loop EnterMsgLoop(m_pMsgServer); }