|
-
Jul 4th, 2011, 10:33 PM
#1
Thread Starter
Member
[RESOLVED] WriteConsole doesn't run the code
Hi guys,
I am trying to communicate with a chess engine from inside my VB6 code.
I can't simply call the engine with Shell, because it doesn't accept one-line commands. So I decided to run the engine within my code, but then get control over the console and issue the sequential commands into it.
The problem now is that, based on the Microsoft article written here, I could succeffully write a VB sample code that opens the console, I can run my engine inside the console, but then using the WriteConsole when I want to issue the next command, it actually only *writes* then next command, but not *run* it.
If in the opened console I manually type "uci" (the next command that I need to run) and press enter it works, but when I write for example:
Code:
Shell "engine.exe"
Sleep (1000)
sOut = "uci" & vbCrLf
Result = WriteConsole(hConsole, ByVal sOut, Len(sOut), cWritten, _
ByVal 0&)
This code causes the code to write "uci" on the console at the right place, but doesn't run it!
I tried a lot to simulate a "enter key stroke" both in VB and DOS (e.g. VbNewline, Chr(13), 0d0a, vbCrlf, ...), but no one works.
I know that the WriteConsole is actually meant to just write the characters, but is there any alternative command to *run* the written command, or better, to just run a command in the console?
Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|