CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 1999
    Posts
    22

    How can I catch MS-Dos window message?

    Some exes like java.exe, javac.exe, display
    output on the MS-Dos window. How can I
    catch the message if I use

    CreateProcess
    ShellExecute
    ShellExecuteEx

    to execute them from a my appliucation created
    by VC++?


    Your advice would be highly appreciated.

    Xiaojian Liu



  2. #2
    Join Date
    Dec 2003
    Location
    Buenos Aires Argentina
    Posts
    29
    I need the same thing. im executing mysqldump.exe and mysql.exe, how toknow if execution failed, error messages, results, etc? they are in a DOS window.

    Thanks

  3. #3
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    Originally posted by laura_glow
    I need the same thing. im executing mysqldump.exe and mysql.exe, how toknow if execution failed, error messages, results, etc? they are in a DOS window.

    Thanks
    your not explaning it clear...or maybe we are not hearing it clear...

  4. #4
    Join Date
    Dec 2003
    Location
    Buenos Aires Argentina
    Posts
    29
    well, for example, i could get the exit code from mysql.exe (executed with shellExecuteEx from my visual c++ application) with

    Code:
    BOOL GetExitCodeProcess(
      HANDLE hProcess,     // handle to the process
      LPDWORD lpExitCode   // address to receive termination status
    );
    the problem is i cant find the exit codes for that program, so is there any other way to know if the execution of mysql.exe and its parameter was successfull?

    Code:
    C:\backup>mysqldump sdlfkj
    -- MySQL dump 8.22
    --
    -- Host: localhost    Database: sdlfkj
    ---------------------------------------------------------
    -- Server version       3.23.51-max-nt
    mysqldump: Got error: 1044: Access denied for user: '@localhost' to database 'sdlfkj' when selecting the database
    here is an error example from mysqldump, with this parameter (purposefully wrong) it sends error 1044, is there a list of this errors somewhere?

    how can i know if something went wrong from my visual c++ application?

  5. #5
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    winerror.h... getlasterror(...) errorlook.exe(...) tell me when to stop

  6. #6
    Join Date
    Nov 2003
    Location
    Chennai, India
    Posts
    12
    Hi,

    You can use ShellExecute(NULL,"open","full path with file name","full path with arguments", default directory,cmdshow)

    With Regards,
    R.Selvam

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