Results 1 to 5 of 5

Thread: ShellExecute

  1. #1

    Thread Starter
    Frenzied Member CyberCarsten's Avatar
    Join Date
    Sep 1999
    Location
    Aalborg Ø, Denmark
    Posts
    1,544

    ShellExecute

    What does ShellExecute return if it fails???
    razor
    Software Engineer Student, Aalborg University, Denmark
    http://www.cs.auc.dk

    My email at AUC: will get a new email soon
    My website: http://www.razorsoftware.net


    Windows XP Pro/ Gentoo Linux (Laptop)
    Windows XP Pro (Home PC)

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    If the function succeeds, the return value is the instance handle of the application that was run, or the handle of a dynamic data exchange (DDE) server application.

    If the function fails, the return value is an error value that is less than or equal to 32. The following table lists these error values:
    0
    The operating system is out of memory or resources.

    ERROR_FILE_NOT_FOUND
    The specified file was not found.

    ERROR_PATH_NOT_FOUND
    The specified path was not found.

    ERROR_BAD_FORMAT
    The .EXE file is invalid (non-Win32 .EXE or error in .EXE image).

    SE_ERR_ACCESSDENIED
    The operating system denied access to the specified file.

    SE_ERR_ASSOCINCOMPLETE
    The filename association is incomplete or invalid.

    SE_ERR_DDEBUSY
    The DDE transaction could not be completed because other DDE transactions were being processed.

    SE_ERR_DDEFAIL
    The DDE transaction failed.

    SE_ERR_DDETIMEOUT
    The DDE transaction could not be completed because the request timed out.

    SE_ERR_DLLNOTFOUND
    The specified dynamic-link library was not found.

    SE_ERR_FNF
    The specified file was not found.

    SE_ERR_NOASSOC
    There is no application associated with the given filename extension.

    SE_ERR_OOM
    There was not enough memory to complete the operation.

    SE_ERR_PNF
    The specified path was not found.

    SE_ERR_SHARE
    A sharing violation occurred.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3

    Thread Starter
    Frenzied Member CyberCarsten's Avatar
    Join Date
    Sep 1999
    Location
    Aalborg Ø, Denmark
    Posts
    1,544
    Yes i just found those error codes, but how do I compare it...I tried the following but it didn't work....since it returns an HINSTANCE and compare it against a string...

    PHP Code:
    #include <iostream.h>
    #include <windows.h>

    int main(){
        
    char path[MAX_PATH];
        
        
    cout<<"Input the file to be launched: ";
        
    cin>>path;
        if (
    ShellExecute(NULL,"open",path,NULL,NULL,SW_SHOWNORMAL)==ERROR_FILE_NOT_FOUND )
            
    cout<<"error";
            
    system("PAUSE");

    return 
    0;

    razor
    Software Engineer Student, Aalborg University, Denmark
    http://www.cs.auc.dk

    My email at AUC: will get a new email soon
    My website: http://www.razorsoftware.net


    Windows XP Pro/ Gentoo Linux (Laptop)
    Windows XP Pro (Home PC)

  4. #4
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    Try casting it as an integer.
    PHP Code:
    #include <iostream.h>
    #include <windows.h>

    int main(){
        
    char path[MAX_PATH];
        
        
    cout<<"Input the file to be launched: ";
        
    cin>>path;
        if ((int)
    ShellExecute(NULL,"open",path,NULL,NULL,SW_SHOWNORMAL)==ERROR_FILE_NOT_FOUND )
            
    cout<<"error";
            
    system("PAUSE");

    return 
    0;

    Baaaaaaaaah

  5. #5

    Thread Starter
    Frenzied Member CyberCarsten's Avatar
    Join Date
    Sep 1999
    Location
    Aalborg Ø, Denmark
    Posts
    1,544
    Thanks!
    razor
    Software Engineer Student, Aalborg University, Denmark
    http://www.cs.auc.dk

    My email at AUC: will get a new email soon
    My website: http://www.razorsoftware.net


    Windows XP Pro/ Gentoo Linux (Laptop)
    Windows XP Pro (Home PC)

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