To end my question, I decided to use FreeBasic instead of QB64.
Writing Code Against UCI Chess Engine

Well, it's obnoxious to recommend another language in a situation like this, but UCI communication falls out pretty easy in Python.
http://stackoverflow.com/questions/12341882/how-to-communicate-with-a-chess-engine-in-
That's skeleton code, not final code, but it's a great place to start.

Hi, maybee someone out there will find this information useful. Here is a very basic UCI with just the minimal functionality to play from the start position in python:
import (Your engine goes here)
import gc
class UCI:
def coms():
gc.disable()
while(True):
command = input()
parsed_command = command.split(" ")
if parsed_command[0] == "uci":
print("id name (your engine name)")
print("id author (your name)")
print("uciok")
elif parsed_command[0] == "isready":
print("readyok")
elif parsed_command[0] == "position":
if parsed_command[1] == "startpos":
game = yourengine.create_new_game()
for move in parsed_command[3:]:
game.move(move)
elif parsed_command[0] == "go":
if parsed_command[1] == "infinite":
best_move = game.search()
print("bestmove {}".format(best_move))
gc.collect()
elif parsed_command[0] == "stop":
exit()
elif parsed_command[0] == "quit":
quit()
if __name__ == "__main__":
UCI.coms()
Hello programmers, I decided to use this old topic for my question, as it looks like a good one to share informations about GUI programming and communication with UCIs. Input and output was always my nightmare even when there were only two sides, program and user. With engine as a third guest to the party I'm quite confused.
What way should my GUI using c++ WinApi communicate with an UCI engine, how should some "main cycle" of communicating with engine look like, which functions should I generally look for, should I use new thread (I never used more threads in my app except of using omp for parallel algorithms, so please don't be too brief on that problem) for that cycle or is there any other standard approach to constantly checking and writing to UCI engine?
This is what I found on some developer forum about input and output redirection in WinApi and what could be solid starting point for the communication with UCI. The ReadFile is already a problematic function to use I presume. When I pause the algorithm after WriteFile call, this ReadFile reads whole info about engine. When I don't pause algorithm after WriteFile, it reads only the first letter, as the engine isn't fast enough to write the whole answer I guess.
HANDLE child_input_read;
HANDLE child_input_write;
HANDLE child_output_read;
HANDLE child_output_write;
DWORD bytes_read;
DWORD bytes_written;
char buffer[4096];
char message[] = "uci";
PROCESS_INFORMATION process_info;
STARTUPINFO startup_info;
SECURITY_ATTRIBUTES security_attributes;
// Set the security attributes for the pipe handles created
security_attributes.nLength = sizeof(SECURITY_ATTRIBUTES);
security_attributes.bInheritHandle = TRUE;
security_attributes.lpSecurityDescriptor = NULL;
CreatePipe(&child_output_read, &child_output_write, &security_attributes, 0);
CreatePipe(&child_input_read, &child_input_write, &security_attributes, 0);
// Create the child process
ZeroMemory(&process_info, sizeof(PROCESS_INFORMATION));
ZeroMemory(&startup_info, sizeof(STARTUPINFO));
startup_info.cb = sizeof(STARTUPINFO);
startup_info.hStdInput = child_input_read;
startup_info.hStdOutput = child_output_write;
startup_info.hStdError = child_output_write;
startup_info.dwFlags |= STARTF_USESTDHANDLES;
CreateProcess(NULL, szEngineFile, NULL, NULL, TRUE, 0, NULL, NULL, &startup_info, &process_info);
// Write a message to the engine
WriteFile(child_input_write,message,strlen(message),&bytes_written,NULL);
// Read the message from the engine
ReadFile( child_output_read, buffer, sizeof(buffer), &bytes_read, NULL);
buffer[bytes_read] = 0;
// Display the message in a message box
MessageBoxA(NULL, buffer, "Message From engine", MB_OK);
Thank you for help!