ShellExecute() behavior

This is a discussion on ShellExecute() behavior within the Windows Programming forums, part of the Platform Specific Boards category; Hello. I'm using ShellExecute() to launch a document file in its default application. However, the function just opens up the ...

  1. #1
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    920

    ShellExecute() behavior

    Hello. I'm using ShellExecute() to launch a document file in its default application. However, the function just opens up the file's directory in explorer instead. Assuming that I'm calling the function correctly (a bold assumption), what could be causing this?
    Code:
    ShellExecute(NULL,"open",decoded_path.c_str(),NULL,NULL,SW_SHOWNORMAL);
    //decoded_path is "c:\pic.bmp", which is set to open in Paint by default
    I'm running under Windows 98, using Bloodshed C++.

    *edit* does
    ----------------------
    lpDirectory
    [in] Pointer to a null-terminated string that specifies the default directory.
    -----------------------
    have anything to do with it?
    Last edited by CodeMonkey; 12-21-2006 at 01:26 PM.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  2. #2
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    920
    Well, I solved it. Apparently, if an "open" fails, then the directory is opened. I had forgotten to release the file (from ofstream) before trying to open it, and so there was a sharing error. Now it works.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ShellExecute Problem
    By dhrodrigues in forum Windows Programming
    Replies: 2
    Last Post: 04-12-2004, 04:17 PM
  2. ShellExecute() string problem
    By henrikstolpe in forum Windows Programming
    Replies: 2
    Last Post: 05-21-2003, 10:54 AM
  3. Game Design Topic #1 - AI Behavior
    By TechWins in forum Game Programming
    Replies: 13
    Last Post: 10-11-2002, 11:35 AM
  4. ShellExecute and popups or MessageSending
    By Unregistered in forum Windows Programming
    Replies: 0
    Last Post: 01-03-2002, 09:50 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21