You need to write a program to exchange data with the device on a virtual COM port. The program is stuck in the ReadFile and does not go further. I tried different examples that I found on the network - the result is the same.
#include <Windows.h> #include <iostream> using namespace std; int main() { DCB dcb; HANDLE port = CreateFile("COM9", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); BuildCommDCB("baud=9600 parity=N data=8 stop=1", &dcb); char buf_out[1024] = "$016"; char buf_in[1024]; DWORD oSize = sizeof(buf_out); DWORD BytesWritten; DWORD iSize; while (1) { WriteFile(port, buf_out, oSize, &BytesWritten, NULL); ReadFile(port, &buf_in, sizeof(buf_in), &iSize, 0); cout << buf_in << endl; } CloseHandle(port); system("pause"); return 0; }