CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 1999
    Location
    Germany
    Posts
    130

    Launch app from app

    Hi,

    I would like to launch another app from my program. How can I do this ?

    (Devstudio, MFC app)


    Thanks !

    PUH



  2. #2
    Join Date
    Jul 1999
    Location
    Israel
    Posts
    34

    Re: Launch app from app

    Use CreateProcess(..)


  3. #3
    Join Date
    Jul 1999
    Location
    Romania - Iasi
    Posts
    558

    Re: Launch app from app

    If app you want to launch requires parameters:


    char str[] = app_to_launch + parameters
    STARTUPINFO startup;
    PROCESS_INFORMATION process;
    memset( &startup, 0, sizeof( startup ) );
    startup.cb = sizeof( startup );
    memset( &process, 0, sizeof( process ) );
    BOOL tSuccess = CreateProcess( NULL, str, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &process );
    HWINSTA sta = GetProcessWindowStation();

    if( tSuccess )
    {
    // Close the handles that CreateProcess returned so we don't leak
    // kernel resources.
    ASSERT( process.hProcess != NULL );
    CloseHandle( process.hProcess );
    ASSERT( process.hThread != NULL );
    CloseHandle( process.hThread );
    }




    If not have parameters

    CString str = app_to_launch
    .............
    BOOL tSuccess = CreateProcess( str, NULL, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &process );
    .......................




    hope this help you

    Regards,
    Ovidiu


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured