Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CreateProcess( );

CreateProcess( );

Scheduled Pinned Locked Moved C / C++ / MFC
game-devhelpquestion
9 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Soren Alsbjerg Horup
    wrote on last edited by
    #1

    I'm trying to get my App to luanch a program, like Quake 3. using CreateProcess(); I got two problems.. One is that Quake 3 looks for a default.cfg in the Defualt dir, but my program changes the defualt dir to the path to my program, so Quake 3 thinks that the default.cfg file is located where my program is located, but it is not. the second problem is that I can't include consol commands.. like "d:\games\half-life\hl.exe -game cstrike" This won't work.. code: CreateProcess( NULL,Game[0].Path,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi ); Any solution to these two problems? Thanks

    S R 2 Replies Last reply
    0
    • S Soren Alsbjerg Horup

      I'm trying to get my App to luanch a program, like Quake 3. using CreateProcess(); I got two problems.. One is that Quake 3 looks for a default.cfg in the Defualt dir, but my program changes the defualt dir to the path to my program, so Quake 3 thinks that the default.cfg file is located where my program is located, but it is not. the second problem is that I can't include consol commands.. like "d:\games\half-life\hl.exe -game cstrike" This won't work.. code: CreateProcess( NULL,Game[0].Path,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi ); Any solution to these two problems? Thanks

      S Offline
      S Offline
      SamirSood
      wrote on last edited by
      #2

      You can use the APIs like SetCurrentDirectory to change the current working directory of your program Samir Sood

      S 1 Reply Last reply
      0
      • S Soren Alsbjerg Horup

        I'm trying to get my App to luanch a program, like Quake 3. using CreateProcess(); I got two problems.. One is that Quake 3 looks for a default.cfg in the Defualt dir, but my program changes the defualt dir to the path to my program, so Quake 3 thinks that the default.cfg file is located where my program is located, but it is not. the second problem is that I can't include consol commands.. like "d:\games\half-life\hl.exe -game cstrike" This won't work.. code: CreateProcess( NULL,Game[0].Path,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi ); Any solution to these two problems? Thanks

        R Offline
        R Offline
        redeemer
        wrote on last edited by
        #3

        Use ShellExecute() instead.

        T S 2 Replies Last reply
        0
        • S SamirSood

          You can use the APIs like SetCurrentDirectory to change the current working directory of your program Samir Sood

          S Offline
          S Offline
          Soren Alsbjerg Horup
          wrote on last edited by
          #4

          yeah, But if I have a string like: "d:\games\quake3\quake3.exe" and want to set the currentdir like: SetCurrentDirectory("d:\games\quake3\quake3.exe") I need to remove the quake3.exe but how?.

          1 Reply Last reply
          0
          • R redeemer

            Use ShellExecute() instead.

            T Offline
            T Offline
            Tomasz Sowinski
            wrote on last edited by
            #5

            Instead of copying MSDN article, just post a link next time. Tomasz Sowinski -- http://www.shooltz.com

            - It's for protection
            - Protection from what? Zee Germans?

            1 Reply Last reply
            0
            • R redeemer

              Use ShellExecute() instead.

              S Offline
              S Offline
              Soren Alsbjerg Horup
              wrote on last edited by
              #6

              Ok I see. But I need a function that returns the path of the file. Like 'd:\games\quake 3\quake3.exe' will return 'd:\games\quake 3\' Any function that does this? thanks.

              T R J 3 Replies Last reply
              0
              • S Soren Alsbjerg Horup

                Ok I see. But I need a function that returns the path of the file. Like 'd:\games\quake 3\quake3.exe' will return 'd:\games\quake 3\' Any function that does this? thanks.

                T Offline
                T Offline
                Tomasz Sowinski
                wrote on last edited by
                #7

                Visual Basic is great for things like that :-D Tomasz Sowinski -- http://www.shooltz.com

                - It's for protection
                - Protection from what? Zee Germans?

                1 Reply Last reply
                0
                • S Soren Alsbjerg Horup

                  Ok I see. But I need a function that returns the path of the file. Like 'd:\games\quake 3\quake3.exe' will return 'd:\games\quake 3\' Any function that does this? thanks.

                  R Offline
                  R Offline
                  redeemer
                  wrote on last edited by
                  #8

                  Just parse the string from right to left, and keep adding a char to a buffer until it encounters a '\'.

                  1 Reply Last reply
                  0
                  • S Soren Alsbjerg Horup

                    Ok I see. But I need a function that returns the path of the file. Like 'd:\games\quake 3\quake3.exe' will return 'd:\games\quake 3\' Any function that does this? thanks.

                    J Offline
                    J Offline
                    JohnnyG
                    wrote on last edited by
                    #9

                    Look up: _makepath, _fullpath, and _splitpath in MSDN :) I've used these before.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups