Anybody got a working example of using WriteConsoleInput? It gives me
a lot of problems.
Regards
Peter
------------------
a lot of problems.
Regards
Peter
------------------
TYPE INPUT_RECORD EventType AS WORD '<------------------------ DWORD !!! Event AS EventStruc END TYPE
TYPE INPUT_RECORD DWORD EventType AS WORD Event AS EventStruc END TYPE
#Compile Exe #Register None DefLng A-Z #Include "win32Api.inc" Function PbMain AllocConsole kStdIn = GetStdHandle(%STD_INPUT_HANDLE) ReDim InputRecords(1 To 100) As INPUT_RECORD i = Shell ("SORT.Exe", 1): Sleep 1000 w$ = "Semen" + $CRLF + "Peter" + $CRLF + Chr$(26) + $CR For i = 1 To Len(w$) Incr n InputRecords(n).EventType = %KEY_EVENT InputRecords(n).Event.keyEvent.bKeyDown = 1 InputRecords(n).Event.keyEvent.wRepeatCount = 1 InputRecords(n).Event.keyEvent.wVirtualScanCode = 0 ' Use correct ! InputRecords(n).Event.keyEvent.dwControlKeyState = 0 inputRecords(n).Event.KeyEvent.uChar = Asc(Mid$(w$, i, 1)) Incr n InputRecords(n) = InputRecords(n - 1) InputRecords(n).Event.keyEvent.bKeyDown = 0 Next WriteConsoleInput kStdIn, InputRecords(1), n, n Sleep 2000 FreeConsole End Function
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment