1. Yuri Denshchik
  2. PowerBuilder
  3. Monday, 18 June 2018 22:56 PM UTC

I need to modify Roland's RunAndWait of_run()  from http://www.topwizprogramming.com/freecode_runandwait.html to capture process output 

So far no luck :( 

Here is the code I added before CreateProcess call:

// open file for write
ls_outputFileName = "c:\temp\output.log"
lul_file = CreateFile(ls_outputFileName, GENERIC_READ_WRITE, &
FILE_SHARE_WRITE, 0, CREATE_ALWAYS, 0, 0)
If lul_file <> INVALID_HANDLE_VALUE Then
    setNull(lstr_si.hStdInput)
    lstr_si.hStdOutput = lul_file
    lstr_si.hStdError = lul_file;
End If
/*
Function ulong CreateFile ( &
string lpFileName, &
ulong dwDesiredAccess, &
ulong dwShareMode, &
ulong lpSecurityAttributes, &
ulong dwCreationDisposition, &
ulong dwFlagsAndAttributes, &
ulong hTemplateFile &
) Library "kernel32.dll" Alias For "CreateFileW"
*/
 
 

The file gets created but it is empty.

Here is c++ code I found:
https://stackoverflow.com/questions/7018228/how-do-i-redirect-output-to-a-file-with-createprocess

Please advise.

Thank you,

Yuri

 

Kevin Ridley Accepted Answer Pending Moderation
  1. Tuesday, 19 June 2018 12:58 PM UTC
  2. PowerBuilder
  3. # 1

Based on what I see there, you are just creating the file.  Where is the code that writes to it?

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 19 June 2018 02:19 AM UTC
  2. PowerBuilder
  3. # 2

In the example you linked to, the redirection character is a DOS Command Prompt command.

What exactly is it that you want to do from PB?

Comment
  1. Yuri Denshchik
  2. Tuesday, 19 June 2018 22:27 PM UTC
That does not work

  1. Helpful
  1. Brad Mettee
  2. Wednesday, 20 June 2018 13:01 PM UTC
The file is supposed to remain open. The handle for it is passed into the CreateProcess call in the lstr_si structure.

  1. Helpful
  1. Yuri Denshchik
  2. Wednesday, 20 June 2018 16:01 PM UTC
That is what code above does. But the file is empty, where is the catch? 

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.