Thread: Using a program to open a program?

  1. #16
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by CommonTater View Post
    Ummmm... Windows 7 will accept forward slashes... don't try it on XP or previous.
    I suggest you try it and see for yourself. I use forward slashes, even on the command line, and it works fine on 2000 and newer. I believe the microsoft documentation explicitly states that forward slashes are supported in path names for 2000 and above. it's also explicitly supported (I believe) in a standards-compliant C or C++ compiler.

  2. #17
    Registered User muffinman8641's Avatar
    Join Date
    Feb 2011
    Location
    Eastern-Central PA
    Posts
    76
    Oh goodness, I'm so confused.

    ShellExecute didn't work, unless I did something wrong with it (included <shellapi.h> and put my root stuff into the correct quotes).

    I'm surprised there isn't some little statement that opens it (like ShellExecute or something). Elysia, I guess, even if I managed to compile it error-free, I'd use it as a header? But then how do I use it?

  3. #18
    Registered User
    Join Date
    Sep 2010
    Posts
    69
    Quote Originally Posted by muffinman8641 View Post
    Oh goodness, I'm so confused.

    ShellExecute didn't work, unless I did something wrong with it (included <shellapi.h> and put my root stuff into the correct quotes).

    I'm surprised there isn't some little statement that opens it (like ShellExecute or something). do I use it?

    muffinman,
    when people here give you advise, they might not always give you the absolute full details.
    That's so that you can learn by researching the problem.

    The example Tater gave you does work, as shown.
    What he did not state, and you could have researched in the SDK or MSDN, was that ShellExecute requires that you link to the shell32.lib library.

    This code works:
    Code:
    #include <stdio.h>
    #include <windows.h>
    #include <shellapi.h>
    
    int main()
    {
    
      ShellExecute(NULL,"Open", "C:\\windows\\notepad.exe",NULL,NULL,SW_SHOWNORMAL);
    
       return 0;
    }
    ** in your IDE, add to your linker options: shell32.lib

    The above illustrates a console mode app., however, the code works in a gui app. as well.

    -edit-

    muffinman,
    If you are going to be programming windows, there are two things you need:
    1) a bookmark to MSDN: http://msdn.microsoft.com/en-us/default.aspx
    2) a download copy of the SDK.
    Last edited by Steve A.; 03-17-2011 at 07:40 AM.

  4. #19
    Registered User muffinman8641's Avatar
    Join Date
    Feb 2011
    Location
    Eastern-Central PA
    Posts
    76
    OK, I've got this part figured out (you can use system("file location here")). Now I'm working on finding how to make it locate a root folder...
    Last edited by muffinman8641; 03-17-2011 at 07:50 AM.

  5. #20
    Registered User
    Join Date
    Sep 2010
    Posts
    69
    Quote Originally Posted by muffinman8641 View Post
    Now I'm working on finding how to make it locate a root folder...
    What does "make it locate" mean ?
    Either you know a specific path or you don't.
    Do you know the path to what you are looking for ?

  6. #21
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Be aware that this user is also getting advice here.

  7. #22
    Registered User
    Join Date
    Sep 2010
    Posts
    69

    Wink

    Quote Originally Posted by rags_to_riches View Post
    Be aware that this user is also getting advice here.
    Check.

  8. #23
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    FYI, system is bad. Security problem abound.
    I already told you what you needed to get it to compile, but I haven't heard back from you anything afterwards, so you can't blame me if you can't get it compiling.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How To Make A Program Remain Open For Windows XP
    By BrandNew in forum C Programming
    Replies: 3
    Last Post: 02-22-2011, 08:28 AM
  2. Hi, Quiz C program Assignment updated
    By Eman in forum C Programming
    Replies: 19
    Last Post: 11-22-2009, 04:50 PM
  3. program to open IE
    By x2012 in forum C# Programming
    Replies: 2
    Last Post: 11-03-2006, 09:07 PM
  4. how to make certain file types open IN your program
    By DarkViper in forum Windows Programming
    Replies: 4
    Last Post: 02-06-2003, 11:37 PM
  5. drawing over the open program.
    By Unregistered in forum Windows Programming
    Replies: 6
    Last Post: 01-23-2002, 03:37 PM