Problem with ENTER key using writeconsoleinput

Questions about Wine on Linux
Locked
mrharibo
Newbie
Newbie
Posts: 2
Joined: Tue Jan 19, 2021 7:59 am

Problem with ENTER key using writeconsoleinput

Post by mrharibo »

Hey,

I am writing a program in VB.NET that will write text to a console program (ConsoleWindowClass). I am using the WriteConsoleInput function (kernel32.dll).
Everything works until you try to enter the ENTER key. Only "^ M" appears in the console instead of going to a new line.

I noticed that "Win32" wineconsole does not read control codes at all. In the "EMACS" version they work, but from my program it still shows "^ M".
Anyone have any idea how to solve this problem?

My wine ver: 6.0

I am adding a test program with a project in Visual Studio.

https://drive.google.com/file/d/1DOWuTz ... sp=sharing - .EXE test program

https://drive.google.com/file/d/1BIV3K3 ... sp=sharing - Visual Studio project in zip file
mrharibo
Newbie
Newbie
Posts: 2
Joined: Tue Jan 19, 2021 7:59 am

Re: Problem with ENTER key using writeconsoleinput

Post by mrharibo »

WELL,
After many attempts, I found out that I need to add to VirtualKeyCode & VirtualScanCode.

I mean :

Code: Select all

        inputKeys(0).EventType = InputEventTypes.KEY_EVENT
        inputKeys(0).KeyEvent.bKeyDown = 1&
        inputKeys(0).KeyEvent.dwControlKeyState = 288&
        inputKeys(0).KeyEvent.wRepeatCount = 1&
        inputKeys(0).KeyEvent.uChar = ChrW(13)
        inputKeys(0).KeyEvent.wVirtualKeyCode = 13&
        inputKeys(0).KeyEvent.wVirtualScanCode = 28& 
That should look complete KEY_EVENT for ENTER key.
Everything works now.
Locked