My question is quite simple, but the solution seems absolutely impossible for me to find.
I have a dedicated game server (JEDI ACADEMY JAMPDED), which is a console application. It writes some information continously and I want to handle the data somehow. It would be easy if I could read the output of it with external.
Problem: It does not write to Standard Output, so can't be piped with batch file and popen does not work also.
So I wanted to do with WINAPI. I was able to create the process, but still can't read the output.
I tried these:
How do I call ::CreateProcess in c++ to launch a Windows executable?
CreateProcess and CreatePipe to execute a process and return output as a string in VC++
AND the MSDN official example, but still nothing.
This is the jampded.exe:

I got a visual-basic code from my friend, who reads ConsoleInput from Ingame, so I'm pretty sure, that it is possible to read the console:
SNIPPET:
Global hWnd = FindWindow_(#Null,"Jedi Knight Academy MP Console") ;console window
Global hWnd2 = FindWindow_(#Null,"Jedi Knight®: Jedi Academy (MP)") ;actual game window
Global inputhWnd = FindWindowEx_(hwnd,0,"edit",0) ;the one to send stuff to
Global consolehWnd = FindWindowEx_(hwnd,inputhWnd,"edit",0) ;the one to read the console from
Procedure checkConsole()
Protected wholetext.s, oldtext.s,text.s, checkname.s
Repeat
wholetext = getText()
If wholetext
text = StringField(wholetext,CountString(wholetext,#CRLF$),#CRLF$)
If oldtext <> text
oldtext = text
analyseConsole(@text)
EndIf
EndIf
Delay(20)
writePreferences()
Until quit
EndProcedure
Procedure.s getText()
Protected wholetext.s
If hWnd And hWnd2
If Not inputhWnd Or Not consolehWnd
inputhWnd = FindWindowEx_(hWnd,0,"edit",0)
consolehWnd = FindWindowEx_(hWnd,inputhWnd,"edit",0)
EndIf
length = SendMessage_(consolehWnd, #WM_GETTEXTLENGTH, 0, 0)
wholetext = Space(length)
SendMessage_(consolehWnd,#WM_GETTEXT,length + SizeOf(Character),@wholetext)
ProcedureReturn wholetext
Else
If FindWindow_(#Null,"Jedi Knight Academy MP Console")
hWnd = FindWindow_(#Null,"Jedi Knight Academy MP Console")
hWnd2 = FindWindow_(#Null,"Jedi Knight®: Jedi Academy (MP)")
inputhWnd = FindWindowEx_(hwnd,0,"edit",0)
consolehWnd = FindWindowEx_(hwnd,inputhWnd,"edit",0)
EndIf
ProcedureReturn ""
EndIf
If @wholetext > 0
FreeMemory(@wholetext)
EndIf
EndProcedure
Maybe this could help me and others too :)


command 2> file. Then again, another question stackoverflow.com/q/17064302/393701 suggests that jampded might actually detach itself from the console...ReadConsoleOutputand friends, although depending on how much output there is this may not be practical.jampded, you've got your special place reserved.