Ejemplo n.º 1
0
void HandleStart()
{
	RDebug::Print(_L("TrkLauncher::HandleStart()"));
	
	if (!IsAlreadyRunning())
	{		
		TInt result;		
		RProcess p;
		
		//start TrkConsole	process
		result = p.Create(KTrkConsoleExe, TPtr(NULL, 0), TUidType(KNullUid, KNullUid, KTrkConsoleExeUid));
		if (result == KErrNone)
		{
			RDebug::Print(_L("TrkLauncher - Trk process resume"));
			p.Resume();
			RDebug::Print(_L("TrkLauncher - After Trk process resume"));
			p.Close();
			RDebug::Print(_L("TrkLauncher - After Trk process close"));
		}
		else
		{
			RDebug::Print(_L("TrkLauncher - Trk process not created with %d \n"),result);
			RDebug::Print(_L("TrkLauncher - Returning without process creation"));
		}
			
	}
}
Ejemplo n.º 2
0
int Trackobot::Run() {
  if( IsAlreadyRunning() )
    return 1;

  LOG( "Launch v%s on %s", VERSION, qt2cstr( QDate::currentDate().toString( Qt::ISODate ) ) );

  SetupUpdater();

  CreateUI();

  Initialize();

  SetupLogging();

  int exitCode = mApp.exec();

  // Tear down
  LOG( "Shutdown" );

  return exitCode;
}
Ejemplo n.º 3
0
//*********************************************************************//
// WinMain
//	- application entry point
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{	
	// Don't let more than one instance of the application exist
	if( IsAlreadyRunning() == true )
		return -1;
    

	// Create the window
	HWND hWnd = MakeWindow( hInstance );
	if( hWnd == 0 )
	{
		MessageBoxW( HWND_DESKTOP, L"ERROR: Failed to create the Main Window.", WINDOW_TITLE, MB_OK | MB_ICONERROR );
		return -2;
	}


	// Display the window
	ShowWindow( hWnd, nCmdShow );
	UpdateWindow( hWnd );

	
	/////////////////////////////////////////////////////////////////////
	// Initialize game
	
	// Access the singleton
	Game* pGame = Game::GetInstance();

	// Initialize
	if( pGame->Initialize( WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_TITLE ) == false )
		return -3;


	// Run the message loop
	MSG msg = { };
	while( true )
	{
		if( PeekMessageW( &msg, NULL, 0, 0, PM_REMOVE ) == TRUE )
		{ 
			// Quit the application?
			if( msg.message == WM_QUIT )
				break;
		
			// Send the message to the window proc
			DispatchMessageW( &msg );
		}
		else
		{
			/////////////////////////////////////////////////////////////
			// Run game
			int result = pGame->Update();
			if( result != 0 )
				PostQuitMessage( result );
		}
	}
	
	
	/////////////////////////////////////////////////////////////////////
	// Terminate game
	
	pGame->Terminate();
	pGame = nullptr;
	Game::DeleteInstance();



	// Unregister the window class
	UnregisterClassW( WINDOW_CLASS_NAME, hInstance );
	
	// Return message's Quit code to the OS
	return (int)(msg.wParam);
}