CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1

    Runing a program

    Hi, I feel really stupid, but I forgoten how to run a program.

    I don't want to run a "normal windows program" (paint, solitare...) but my own.

    Thanks,

    ~ Selevercin

  2. #2
    Join Date
    May 2002
    Location
    Poland
    Posts
    48
    use ShellExecute()
    regards,
    MiMec

  3. #3
    Join Date
    Nov 2001
    Location
    Beyond Juslibol
    Posts
    1,688
    I also thing that is a good idea to use ShellExecute();

    For example to run codeguru page:

    ShellExecute(this->m_hWnd,"Open","http://www.codeguru.com",NULL,"http://www.codeguru.com",SW_SHOWMAXIMIZED);

    It works but don't ask me why!

  4. #4

    parameters

    Thanks for the ShellExecute() idea. If my program was in:

    C:\MyApp.exe

    How would I call the function?

    I don't understand the parameters correctly, I guess. Thanks,

    ~ Selevercin

  5. #5
    Join Date
    May 2002
    Location
    Poland
    Posts
    48
    Your can do it this way:

    ShellExecute(::GetDesktopWindow(), "open", "YourApp.exe", NULL, "C:\", SW_SHOWNORMAL);
    regards,
    MiMec

  6. #6
    Join Date
    Nov 2001
    Location
    Beyond Juslibol
    Posts
    1,688
    Write this:

    ShellExecute(this->m_hWnd,"Open","C:\\MyFile.exe",NULL,"C:\\",SW_SHOWMAXIMIZED);

    The first parameter is a handle to the window

    The second parameter is what you want to do with the file
    "Open" "Print" or "explore"

    the parameter is the full path of the file

    The 4th parameter are the parameters passed to the "C:\\myfile.exe"

    the 5th parameter is the default directory

    and the 6th parameter is how you want to open the file. (In this example a maximized window)

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