//-------------------------------------------------------------------------------------- // Entry point to the program. Initializes everything and goes into a message processing // loop. Idle time is used to render the scene. //-------------------------------------------------------------------------------------- int WINAPI wWinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpCmdLine*/, int /*nCmdShow*/) { // Enable run-time memory check for debug builds. #if defined(DEBUG) | defined(_DEBUG) _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif // Disable gamma correction on this sample DXUTSetIsInGammaCorrectMode(false); DXUTSetCallbackDeviceChanging(ModifyDeviceSettings); DXUTSetCallbackMsgProc(MsgProc); DXUTSetCallbackFrameMove(OnFrameMove); DXUTSetCallbackD3D11DeviceAcceptable(IsD3D11DeviceAcceptable); DXUTSetCallbackD3D11DeviceCreated(OnD3D11CreateDevice); DXUTSetCallbackD3D11SwapChainResized(OnD3D11ResizedSwapChain); DXUTSetCallbackD3D11FrameRender(OnD3D11FrameRender); DXUTSetCallbackD3D11SwapChainReleasing(OnD3D11ReleasingSwapChain); DXUTSetCallbackD3D11DeviceDestroyed(OnD3D11DestroyDevice); InitApp(); // Force create a ref device so that feature level D3D_FEATURE_LEVEL_11_0 is guaranteed DXUTInit(true, true, NULL); // Parse the command line, show msgboxes on error DXUTSetCursorSettings(true, true); // Show the cursor and clip it when in full screen DXUTCreateWindow(L"OIT11"); DXUTCreateDevice(D3D_FEATURE_LEVEL_11_0, true, g_nFrameWidth, g_nFrameHeight); DXUTMainLoop(); // Enter into the DXUT render loop return DXUTGetExitCode(); }
int WINAPI WinMain(HINSTANCE hCurInst, HINSTANCE hPrevInst, LPSTR lpsCmdLine, int nCmdShow) { MSG msg; BOOL bRet; HACCEL hAccel; // アクセラレータハンドル if (!InitApp(hCurInst)) return FALSE; if (!InitInstance(hCurInst, nCmdShow)) return FALSE; // アクセラレータテーブルを読み込む hAccel = LoadAccelerators(hCurInst, TEXT("MYACCEL")); while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0) { if (bRet == -1) { break; } else { if (!TranslateAccelerator(hParent, hAccel, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } } return (int)msg.wParam; }
int16_t main(void) { // Initialize IO ports and peripherals. ConfigureOscillator(); InitApp(); InitAdc(); AtpInit(); odo_init(); // TODO motion_init(SendDone); SendBoardId(); __delay_ms(3000); SendBoardId(); while(1) { //SendBoardId(); if (odoBroadcast) { OnGetPos(); } __delay_ms(odoDelay); } }
void main(void) { /* Configure the oscillator for the device */ ConfigureOscillator(); /* Initialize I/O and Peripherals for application */ InitApp(); /* everything is an output */ TRISIO = 0; /* turn off all pins */ GPIO = 0x00000000; while(1) { __delay_ms(100); /* turn on GPIO pin 2 */ GPIO = 0b00000100; __delay_ms(100); /* turn off GPIO pin 2 */ GPIO = 0b00000000; } }
void main(void) { /* Configure the oscillator for the device */ ConfigureOscillator(); /* Initialize I/O and Peripherals for application */ InitApp(); InitSPI(); InitInterrupts(); LCD_Init(); RF_ConfigReceiver(); LCD_WriteFirstLine("NRF Initialized"); // LCD_Write(); while(1) { if(RF_ReceiveFlag == 1){ RF_ResetReceiver(); if(RF_ReceiveBuffer[0] == 0x01){ ToggleLED_B7(); LCD_WriteFirstLine("Receive Action:"); LCD_WriteSecondLine("L-Button Pressed"); } else if(RF_ReceiveBuffer[0] == 0x02){ ToggleLED_B7(); LCD_WriteFirstLine("Receive Action:"); LCD_WriteSecondLine("R-Button Pressed"); } } } }
//-------------------------------------------------------------------------------------- // Entry point to the program. Initializes everything and goes into a message processing // loop. Idle time is used to render the scene. //-------------------------------------------------------------------------------------- INT WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int ) { // Enable run-time memory check for debug builds. #if defined(DEBUG) | defined(_DEBUG) _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif // DXUT will create and use the best device (either D3D9 or D3D10) // that is available on the system depending on which D3D callbacks are set below // Set DXUT callbacks DXUTSetCallbackDeviceChanging( ModifyDeviceSettings ); DXUTSetCallbackMsgProc( MsgProc ); DXUTSetCallbackKeyboard( KeyboardProc ); DXUTSetCallbackFrameMove( OnFrameMove ); DXUTSetCallbackD3D10DeviceAcceptable( IsD3D10DeviceAcceptable ); DXUTSetCallbackD3D10DeviceCreated( OnD3D10CreateDevice ); DXUTSetCallbackD3D10SwapChainResized( OnD3D10SwapChainResized ); DXUTSetCallbackD3D10SwapChainReleasing( OnD3D10ReleasingSwapChain ); DXUTSetCallbackD3D10DeviceDestroyed( OnD3D10DestroyDevice ); DXUTSetCallbackD3D10FrameRender( OnD3D10FrameRender ); InitApp(); DXUTInit( true, true, NULL ); // Parse the command line, show msgboxes on error, no extra command line params DXUTSetCursorSettings( true, true ); // Show the cursor and clip it when in full screen DXUTCreateWindow( L"D3D10 Shader Model 4.0 Workshop: Exercise03" ); DXUTCreateDevice( true, 800, 600 ); DXUTMainLoop(); // Enter into the DXUT render loop return DXUTGetExitCode(); }
//-------------------------------------------------------------------------------------- // Entry point to the program. Initializes everything and goes into a message processing // loop. Idle time is used to render the scene. //-------------------------------------------------------------------------------------- int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow ) { // Enable run-time memory check for debug builds. #if defined(DEBUG) | defined(_DEBUG) _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif // DXUT will create and use the best device (either D3D9 or D3D11) // that is available on the system depending on which D3D callbacks are set below // Set DXUT callbacks DXUTSetCallbackDeviceChanging( ModifyDeviceSettings ); DXUTSetCallbackMsgProc( MsgProc ); DXUTSetCallbackKeyboard( OnKeyboard ); DXUTSetCallbackFrameMove( OnFrameMove ); DXUTSetCallbackD3D11DeviceAcceptable( IsD3D11DeviceAcceptable ); DXUTSetCallbackD3D11DeviceCreated( OnD3D11CreateDevice ); DXUTSetCallbackD3D11SwapChainResized( OnD3D11ResizedSwapChain ); DXUTSetCallbackD3D11FrameRender( OnD3D11FrameRender ); DXUTSetCallbackD3D11SwapChainReleasing( OnD3D11ReleasingSwapChain ); DXUTSetCallbackD3D11DeviceDestroyed( OnD3D11DestroyDevice ); InitApp(); DXUTInit( true, true, NULL ); // Parse the command line, show msgboxes on error, no extra command line params DXUTSetCursorSettings( true, true ); // Show the cursor and clip it when in full screen DXUTCreateWindow( L"BasicHLSL11" ); DXUTCreateDevice (D3D_FEATURE_LEVEL_11_0, true, 800, 600 ); //DXUTCreateDevice(true, 640, 480); DXUTMainLoop(); // Enter into the DXUT render loop return DXUTGetExitCode(); }
int16_t main(void) { /* Configure the oscillator for the device */ ConfigureOscillator(); /* Initialize IO ports and peripherals */ InitApp(); TRISBbits.TRISB1 = 0; TRISBbits.TRISB2 = 0; TRISAbits.TRISA2 = 0; LATBbits.LATB1=0; LATBbits.LATB2=0; LATAbits.LATA2=0; IPC0bits.T1IP = 5; //set interrupt priority PR1 = 32767; T1CONbits.TON = 1; T1CONbits.TCS = 1; T1CONbits.TCKPS = 0; IFS0bits.T1IF = 0; //reset interrupt flag IEC0bits.T1IE = 1; //turn on the timer1 interrupt while(1); }
void main(void) { /* Configure the oscillator for the device */ ConfigureOscillator(); /* Initialize I/O and Peripherals for application */ InitApp(); TRISA = 0x00; // If you use RA2 as an input without first setting it as an output, some charge lingers and the input reads high even if the pin is tied to ground. I have a theory as to why this happens but all I really know for sure is that setting it as output first seems to prevent the weird thing from happening. for (int x = 0; x < 5; x++) senderAddress [x] = 0x02; for (int x = 0; x < 5; x++) receiverAddress [x] = 0x01; uint8_t receivedMessage [9]; //runTests(); //loopReceivingTestMessage(); loopSendingTestMessage(); nerf_init (&TRISA, &LATA, &PORTA, &TRISB, &LATB, &PORTB, receiverAddress); while (true){ nerf_receiveAndRespondToCommand(); } }
void main(void) { int count; unsigned int adcValue = 0; unsigned int adcValueOld = 0; char buffer[16]; ConfigureOscillator(); InitApp(); lcd_init(); lcd_enable(); lcd_cursor_off(); lcd_test(); lcd_pos(2, 1); while (1) { ConvertADC(); while (BusyADC()); adcValue = ReadADC(); if (adcValue != adcValueOld) { lcd_clear(); lcd_pos(1, 1); memset(&buffer[0], 0, sizeof(buffer)); sprintf(&buffer[0], "Valor: %.4u %.3u%%", adcValue, (int)(((float)adcValue / 1024) * 100)); lcd_write_buffer(buffer, strlen(buffer)); adcValueOld = adcValue; } __delay_ms(20); } }
AcRx::AppRetCode acrxEntryPoint(AcRx::AppMsgCode msg, void* pkt) { switch(msg) { case AcRx::kInitAppMsg: acrxUnlockApplication(pkt); acrxRegisterAppMDIAware(pkt); InitApp(); break; case AcRx::kUnloadAppMsg: acedRegCmds->removeGroup(_T("DYNBLKAPP")); if (pPts) { ACRX_PROTOCOL_REACTOR_LIST_AT(AcDbBlockTableRecord::desc(), AsdkInsertionPoints::desc())->removeReactor(pPts); delete pPts; pPts = NULL; } break; default: break; } return AcRx::kRetOK; }
//-------------------------------------------------------------------------------------- // Entry point to the program. Initializes everything and goes into a message processing // loop. Idle time is used to render the scene. //-------------------------------------------------------------------------------------- int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow ) { // Enable run-time memory check for debug builds. #if defined(DEBUG) | defined(_DEBUG) _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif // Disable gamma correction on this sample DXUTSetIsInGammaCorrectMode( false ); DXUTSetCallbackDeviceChanging( ModifyDeviceSettings ); DXUTSetCallbackMsgProc( MsgProc ); DXUTSetCallbackFrameMove( OnFrameMove ); DXUTSetCallbackMouse( MouseProc ); DXUTSetCallbackKeyboard( OnKeyboard ); DXUTSetCallbackD3D11DeviceAcceptable( IsD3D11DeviceAcceptable ); DXUTSetCallbackD3D11DeviceCreated( OnD3D11CreateDevice ); DXUTSetCallbackD3D11SwapChainResized( OnD3D11ResizedSwapChain ); DXUTSetCallbackD3D11FrameRender( OnD3D11FrameRender ); DXUTSetCallbackD3D11SwapChainReleasing( OnD3D11ReleasingSwapChain ); DXUTSetCallbackD3D11DeviceDestroyed( OnD3D11DestroyDevice ); InitApp(); DXUTInit( true, true ); DXUTSetCursorSettings( true, true );// Show the cursor and clip when in full screen DXUTCreateWindow( L"Contact Hardening Shadows - Direct3D 11" ); DXUTCreateDevice( D3D_FEATURE_LEVEL_11_0, true, 800, 600 ); DXUTMainLoop(); // Enter into the DXUT render loop return DXUTGetExitCode(); }
// main 함수 임 INT WINAPI wWinMain( HINSTANCE, HINSTANCE, LPWSTR, int ) { // Enable run-time memory check for debug builds. #if defined(DEBUG) | defined(_DEBUG) _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif DXUTSetCallbackD3D9DeviceCreated( OnCreateDevice ); DXUTSetCallbackD3D9DeviceReset( OnResetDevice ); DXUTSetCallbackD3D9FrameRender( OnFrameRender ); //focus를 상실했을 때. 즉 창모드/전체화면 모드 변경시 처리 과정 DXUTSetCallbackD3D9DeviceLost( OnLostDevice ); DXUTSetCallbackD3D9DeviceDestroyed( OnDestroyDevice ); DXUTSetCallbackMsgProc( MsgProc ); //update 역할, 렌더 직전에 변경사항 적용하는 부분 DXUTSetCallbackFrameMove( OnFrameMove ); //조명 초기화 InitApp(); //키보드 단축키를 받아 처리하도록 하는 플래그 설정 함수 DXUTSetHotkeyHandling( true, true, true ); DXUTCreateWindow( L"BasicHLSL" ); DXUTCreateDevice( true, 640, 480 ); // main 무한 루프 // 무한 루프 중 세팅되는 값들을 적용해 화면에 표시함 DXUTMainLoop(); return DXUTGetExitCode(); }
// ------------------------------------------------------------------------------------------ // WinMain // ------------------------------------------------------------------------------------------ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow) { MSG msg; if(!InitApp(hInst, nCmdShow)) CDXError( NULL , "could not initialize CDX application" ); while(1) { if(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { if(!GetMessage(&msg, NULL, 0, 0 )) return msg.wParam; TranslateMessage(&msg); DispatchMessage(&msg); } else if(bActive) { // clear screen Screen->GetBack()->Fill(0); // draw menu CurrentMenu->Draw(300, 150); // display back buffer Screen->Flip(); } else WaitMessage(); } }
//-------------------------------------------------------------------------------------- // Entry point to the program. Initializes everything and goes into a message processing // loop. Idle time is used to render the scene. //-------------------------------------------------------------------------------------- INT WINAPI wWinMain( HINSTANCE, HINSTANCE, LPWSTR, int ) { // Enable run-time memory check for debug builds. #if defined(DEBUG) | defined(_DEBUG) _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif // DXUT will create and use the best device (either D3D9 or D3D10) // that is available on the system depending on which D3D callbacks are set below // Set DXUT callbacks DXUTSetCallbackD3D9DeviceAcceptable( IsDeviceAcceptable ); DXUTSetCallbackD3D9DeviceCreated( OnCreateDevice ); DXUTSetCallbackD3D9DeviceReset( OnResetDevice ); DXUTSetCallbackD3D9FrameRender( OnFrameRender ); DXUTSetCallbackD3D9DeviceLost( OnLostDevice ); DXUTSetCallbackD3D9DeviceDestroyed( OnDestroyDevice ); DXUTSetCallbackMsgProc( MsgProc ); DXUTSetCallbackKeyboard( KeyboardProc ); DXUTSetCallbackFrameMove( OnFrameMove ); DXUTSetCallbackDeviceChanging( ModifyDeviceSettings ); DXUTSetCursorSettings( true, true ); InitApp(); DXUTInit( true, true ); // Parse the command line and show msgboxes DXUTSetHotkeyHandling( true, true, true ); DXUTCreateWindow( L"CompiledEffect" ); DXUTCreateDevice( true, 640, 480 ); DXUTMainLoop(); return DXUTGetExitCode(); }
INT WINAPI wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int) { DXUTSetCallbackD3D9DeviceAcceptable(IsDeviceAcceptable); DXUTSetCallbackD3D9DeviceCreated(OnCreateDevice); DXUTSetCallbackD3D9FrameRender(OnFrameRender); DXUTSetCallbackD3D9DeviceReset(OnResetDevice); DXUTSetCallbackD3D9DeviceLost(OnLostDevice); DXUTSetCallbackD3D9DeviceDestroyed(OnDestroyDevice); DXUTSetCallbackMsgProc(MsgProc); DXUTSetCallbackKeyboard(KeyboardProc); DXUTSetCallbackMouse(MouseProc, true); DXUTSetCallbackFrameMove(OnFrameMove); DXUTSetCallbackDeviceChanging(ModifyDeviceSettings); DXUTSetCursorSettings(true, true); InitApp(); DXUTInit(); DXUTSetHotkeyHandling(); DXUTCreateWindow(L"NsRenju by Ivan Goremykin"); DXUTCreateDevice(true, 1024, 768); DXUTMainLoop(); return DXUTGetExitCode(); }
int main( int argc, char *argv[] ) { int tmpcount; g_argc = argc; g_argv = argv; g_argc = 5; g_argv[0] = 0; g_argv[1] = "121.199.44.76"; g_argv[2] = "22221"; //g_argv[1] = "127.0.0.1"; //g_argv[2] = "11521"; g_argv[3] = "200"; g_argv[4] = "1000"; CheckSystemPath(); InitApp(); fps_count = 0; while(1) { // if( fps_count < 10 ) // Sleep(1000); WaitForSingleObject( g_timer_event, INFINITE ); ResetEvent( g_timer_event); System_Logic(); fps_count++; clrscr(); printf("read list:%d write_list:%d -- %d \r",max_read_list_count, max_write_list_count, g_enter_num ); tmpcount = 0; for( int tmpi = 0; tmpi < g_nClientNum; tmpi++ ) { if( tmpi % 25 == 0 ) printf( "\n" ); if( g_Player[tmpi].stat < 0 ) printf( "#%d", g_Player[tmpi].wait_stat ); else printf( "%2d", g_Player[tmpi].stat ); if( g_Player[tmpi].isconnected ) tmpcount++; } printf( "\nConnected:%d\tSendcount:%d(%d)", tmpcount,g_send_count,g_send_num ); printf( "\n\n" ); printf( " # 等待某状态\t" ); printf( " 0 无状态\t" ); printf( " 1 战斗等待中\n" ); printf( " 2 开始(未登录)\t" ); printf( " 3 已经登录\t" ); printf( " 4 已经列角色\n" ); printf( " 5 游戏普通状态\t" ); printf( " 6 游戏进入战斗\t" ); printf( " 7 等待战斗指令\n" ); printf( " 8 已进入游戏\t" ); printf( " 9 创建角色\n" ); printf( " 10 登出\n" ); } return 0; }
int APIENTRY _tWinMain(HINSTANCE hCurInst, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { // TODO: ここにコードを挿入してください。 MSG msg; BOOL bRet; hInst = hCurInst; //インスタンスハンドルをグローバル変数にコピー // アプリケーションの初期化を実行します: if (!InitApp (hCurInst)) { return FALSE; } if (!InitInstance (hCurInst, nCmdShow)) { return FALSE; } // メイン メッセージ ループ: while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0) { if (bRet == -1) { break; } else { TranslateMessage(&msg); DispatchMessage(&msg); } } return (int) msg.wParam; }
/***************************************************************************** * * WinMain * * Called by C startup code. * * HANDLE hInst - Instance handle of this instance * HANDLE hPrevInst - Instance handle of previous instance or * NULL if we are the first instance * LPSTR lpstrCmdLine - Any command line arguments * int nCmdShow - Code for ShowWindow which tells us what state * to initially show the main application window. * * Initialize application if first instance. * Initialize instance. * Stay in main message processing loop until exit. * *****************************************************************************/ int PASCAL WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpstrCmdLine, int nCmdShow) { MSG msg; if (hPrevInst == NULL) if (!InitApp(hInst)) return 0; if (!InitInstance(hInst, nCmdShow)) { TerminateInstance(); return 0; } while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } TerminateInstance(); return (int) msg.wParam; }
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) { MSG msg; HWND hwndMain=0; int rc; rc = InitApp(hInstance); if (rc) return rc; hwndMain=InitInstance(hInstance,lpCmdLine, nCmdShow); if (hwndMain == 0) return 0x10; flowm_init(); /* Initialize the TTS system */ while (GetMessage(&msg,NULL,0,0)) { TranslateMessage(&msg); DispatchMessage(&msg); } flowm_terminate(); /* Close the TTS systems */ return msg.wParam; }
void main(void) { /* Initialize I/O and Peripherals for application */ InitApp(); //at end of user.c led_counter=0; spk_bit=0; //what are the spk_bits ??? led_bit=0; LCDInit(); LCDClear(); gotoXY(1,11); //(1,11) is about halfway down LCDString("PIC 16LF1786"); while(1) { /* TODO <INSERT USER APPLICATION CODE HERE> */ if(spk_bit==1) { if((spk_enable==1)&&(spk_enable2==1)) LATBbits.LATB6=1; //B6 is the clk in for uploading program to PIC }else LATBbits.LATB6=0; } }
//-------------------------------------------------------------------------------------- // Entry point to the program. Initializes everything and goes into a message processing // loop. Idle time is used to render the scene. //-------------------------------------------------------------------------------------- int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow ) { // Enable run-time memory check for debug builds. #if defined(DEBUG) | defined(_DEBUG) _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif DXUTSetCallbackDeviceChanging( ModifyDeviceSettings ); DXUTSetCallbackMsgProc( MsgProc ); DXUTSetCallbackKeyboard( KeyboardProc ); DXUTSetCallbackFrameMove( OnFrameMove ); DXUTSetCallbackD3D11DeviceAcceptable( IsD3D11DeviceAcceptable ); DXUTSetCallbackD3D11DeviceCreated( OnD3D11CreateDevice ); DXUTSetCallbackD3D11SwapChainResized( OnD3D11ResizedSwapChain ); DXUTSetCallbackD3D11FrameRender( OnD3D11FrameRender ); DXUTSetCallbackD3D11SwapChainReleasing( OnD3D11ReleasingSwapChain ); DXUTSetCallbackD3D11DeviceDestroyed( OnD3D11DestroyDevice ); InitApp(); DXUTInit( true, true ); // Use this line instead to try to create a hardware device DXUTSetCursorSettings( true, true ); // Show the cursor and clip it when in full screen DXUTCreateWindow( L"AdaptiveTessellationCS40" ); DXUTCreateDevice(D3D_FEATURE_LEVEL_10_0, true, 1024, 768 ); DXUTMainLoop(); // Enter into the DXUT render loop return DXUTGetExitCode(); }
/* FUNCTION: WinMain(HINSTANCE, HINSTANCE, LPSTR, int) PURPOSE: Start application and process all window messages PARAMETERS: hInstance - this application's instance hPrevInstance - previous instance of this application (always NULL) lpCmdLine - command line parameters nCmdShow - code for showing the window RETURN: 1 for success 0 for failure to start the application */ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG msg; // Verify that the program can run on this version of windows if (!VersionCheck()) { MessageBox(NULL, "Program cannot run on this version of Windows.", NULL, MB_OK | MB_ICONSTOP); return 0; } // Attempt to initialize the application and create the main window and class if (!InitApp(hInstance, nCmdShow)) { MessageBox(NULL, "Program couldn't start! We don't know why, it just couldn't!", NULL, MB_OK | MB_ICONSTOP); } // Main message loop while (GetMessage(&msg, NULL, 0, 0)) { // Get message from queue // Send message to accelerator to check if it is a keyboard command if (!TranslateAccelerator(ghWndMain, ghAccel, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } return msg.wParam; // Exit parameter to be returned to the OS }
void main(void) { //standard function calls to get the PIC ready ConfigureOscillator(); InitApp(); //three bytes to hold input data //d0: GHCZ marx fill, GHCZ line fill //d1: GHCZ marx dump, GHCZ line dump //d2: GHCZ recirc select, recirc on/off recirc auto/manual unsigned char d0,d1,d2; while(1){ //clock parallel inputs into input shift register InCLK(); //clock inputs in serial into three bytes d0=read_byte(); d1=read_byte(); d2=read_byte(); //process input data and place on output shift registers output(d0,d1,d2); } return; }
int App::Run() { InitApp(); MSG msg; ZeroMemory(&msg, sizeof(MSG)); while (true) { if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) { if(msg.message == WM_QUIT) break; TranslateMessage(&msg); DispatchMessage(&msg); } else { v_Update(); v_Render(); } } v_Shutdown(); return (int)msg.wParam; }
//-------------------------------------------------------------------------------------- // Entry point to the program. Initializes everything and goes into a message processing // loop. Idle time is used to render the scene. //-------------------------------------------------------------------------------------- int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow ) { // Enable run-time memory check for debug builds. #if defined(DEBUG) | defined(_DEBUG) _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif // _crtBreakAlloc = 862; // DXUT will create and use the best device (either D3D9 or D3D10) // that is available on the system depending on which D3D callbacks are set below // Set DXUT callbacks DXUTSetCallbackMsgProc( MsgProc ); DXUTSetCallbackKeyboard( OnKeyboard ); DXUTSetCallbackFrameMove( OnFrameMove ); DXUTSetCallbackDeviceChanging( ModifyDeviceSettings ); DXUTSetCallbackD3D9DeviceAcceptable( IsD3D9DeviceAcceptable ); DXUTSetCallbackD3D9DeviceCreated( OnD3D9CreateDevice ); DXUTSetCallbackD3D9DeviceReset( OnD3D9ResetDevice ); DXUTSetCallbackD3D9DeviceLost( OnD3D9LostDevice ); DXUTSetCallbackD3D9DeviceDestroyed( OnD3D9DestroyDevice ); DXUTSetCallbackD3D9FrameRender( OnD3D9FrameRender ); InitApp(); DXUTInit( true, true, NULL ); // Parse the command line, show msgboxes on error, no extra command line params DXUTSetCursorSettings( true, true ); DXUTCreateWindow( L"SimpleSample" ); DXUTCreateDevice( true, g_nWinSizeX, g_nWinSizeY); DXUTMainLoop(); // Enter into the DXUT render loop return DXUTGetExitCode(); }
//入口 INT WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int ) { //各种相应函数 DXUTSetCallbackDeviceCreated( OnCreateDevice ); DXUTSetCallbackDeviceReset( OnResetDevice ); DXUTSetCallbackDeviceLost( OnLostDevice ); DXUTSetCallbackDeviceDestroyed( OnDestroyDevice ); DXUTSetCallbackMsgProc( MsgProc ); DXUTSetCallbackKeyboard( KeyboardProc ); DXUTSetCallbackFrameRender( OnFrameRender ); DXUTSetCallbackFrameMove( OnFrameMove ); DXUTSetCursorSettings( true, true ); InitApp(); // 创建 窗口 DXUTInit( true, true, true ); DXUTCreateWindow( L"Water Drop" ); DXUTCreateDevice( D3DADAPTER_DEFAULT, true, 700, 700, IsDeviceAcceptable, ModifyDeviceSettings ); //由于最大化会造成形变,这里我们禁用最大化 HWND hWnd=GetActiveWindow(); LONG style=GetWindowLong(hWnd,GWL_STYLE); style &=~(WS_MAXIMIZEBOX); SetWindowLong(hWnd,GWL_STYLE,style); DXUTMainLoop(); return DXUTGetExitCode(); }
int WINAPI WinMain(HINSTANCE hCurInst, HINSTANCE hPrevInst, LPSTR lpsCmdLine, int nCmdShow) { MSG msg; BOOL bRet; HACCEL hAccel; hInst = hCurInst; // グローバル変数にインスタンスハンドルをコピー if (!InitApp(hCurInst)) return FALSE; if (!InitInstance(hCurInst, nCmdShow)) return FALSE; hAccel = LoadAccelerators(hCurInst, TEXT("MYACCEL")); while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0) { if (bRet == -1) { break; } else { if (!hDlg || !IsDialogMessage(hDlg, &msg)) { if (!TranslateAccelerator(hMain, hAccel, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } } } return (int)msg.wParam; }
int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR lpCmdLine, int nShowCmd) { MSG msg; HWND hwnd; g_hinst = hinst; if (!InitApp(lpCmdLine)) return 0; if (SUCCEEDED(CoInitialize(NULL))) {/* In case we use COM */ hwnd = CreateWindow( TEXT("Scratch"), /* Class Name */ TEXT("Scratch"), /* Title */ WS_OVERLAPPEDWINDOW, /* Style */ CW_USEDEFAULT, CW_USEDEFAULT, /* Position */ CW_USEDEFAULT, CW_USEDEFAULT, /* Size */ NULL, /* Parent */ NULL, /* No menu */ hinst, /* Instance */ 0); /* No special parameters */ ShowWindow(hwnd, nShowCmd); while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } CoUninitialize(); } return 0; }
int16_t main(void) { /* Configure the oscillator for the device */ ConfigureOscillator(); /* Initialize IO ports and peripherals */ InitApp(); Init_PWM(); Init_QEI(); AtpInit(); motion_init(SendDone); SendBoardId(); // Petit blink kikou au démarrage int i; for (i = 0 ; i < 14 ; i++) { __delay_ms(50); led = led ^ 1; } SendBoardId(); //pour les AX12 responseReadyAX = 0; while (1){ if (odoBroadcast) { OnGetPos(); } __delay_ms(odoBroadcastDelay); } }