CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2009
    Posts
    9

    Button to launch files

    Hi,

    I'm new to C++ and I came from VB .Net

    I'm using Microsoft Visual C++ Express 2008 and I am trying to launch files from a button.

    In VB .Net, I did this way:
    Code:
    Dim myProcess As New Process
            myProcess.StartInfo.WorkingDirectory = "Files"
            myProcess.StartInfo.FileName = "Test.exe"
            myProcess.Start()
    My program will be used across multiple PCs so I had to set the directory of where the file was located then call forth the name of the file in the next line. I was wondering how I would do that in Visual C++.

    Thanks
    Last edited by weirddemon; January 9th, 2009 at 11:55 AM.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Button to launch files

    Use CreateProcess API or ShellExecute (or ShellExecuteEx)
    Victor Nijegorodov

  3. #3
    Join Date
    Jan 2009
    Posts
    14

    Re: Button to launch files

    Quote Originally Posted by weirddemon View Post
    Hi,

    I'm new to C++ and I came from VB .Net

    I'm using Microsoft Visual C++ Express 2008 and I am trying to launch files from a button.

    In VB .Net, I did this way:
    Code:
    Dim myProcess As New Process
            myProcess.StartInfo.WorkingDirectory = "Files"
            myProcess.StartInfo.FileName = "Test.exe"
            myProcess.Start()
    My program will be used across multiple PCs so I had to set the directory of where the file was located then call forth the name of the file in the next line. I was wondering how I would do that in Visual C++.

    Thanks
    See
    (A newbie's elementary guide to spawning processes)

    http://www.codeproject.com/KB/system/newbiespawn.aspx

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