Not a Member Yet,
Click here to Register
How do you like the new design?
It's cool, great job
[tally: 70%] 70%
It's okay
[tally: 20%] 20%
Its OK but I liked the old layout better
[tally: 0%] 0%
Please bring the old one back
[tally: 10%] 10%

votes: 10

ID: 393
Viewed: 3049
Added: Aug 19, 2002
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo

User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

read from console app

' See KB Article : Q171654

Highlight all by clicking in box
'2. You have wrong declaration of ReadConsoleOutputCharacter Function.

'Use this declaration:

Declare Function ReadConsoleOutputCharacter Lib "kernel32" _
Alias "ReadConsoleOutputCharacterA" (ByVal hConsoleOutput As Long, _
ByVal lpCharacter As String, ByVal nLength As Long, _
ByVal dwReadX As Integer, ByVal dwReadY As Integer, _
lpNumberOfCharsRead As Long) As Long

'3. The first character position In Console Screen Buffer Is (0,0).

X As Integer
Y As Integer
End Type


Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As
ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Declare Function ReadConsoleOutputCharacter Lib "kernel32" Alias
"ReadConsoleOutputCharacterW" (handle As Long, ByVal buffer As String,
As Long, position As COORD, ByVal caracteres As Long) As Long

Highlight All

'1. You need Console Screen Buffer handle instead of Process handle. See
' Microsoft KB Q171654.
Sub Test()
Dim buff As String, position As COORD, caracteres As Long, nbcar As
Long, handle As Long, Processus As Long

Processus = Shell("C:test.bat")
handle = OpenProcess(PROCESS_ALL_ACCESS, 0, Processus)

position.X = 1
position.Y = 1
nbcar = 100

buff = String(nbcar + 1, " ")
msg = ReadConsoleOutputCharacter(handle, buff, nbcar, position,
MsgBox caracteres

End Sub;

No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.

Replying to a Comment...

Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2017 All Rights Reserved. Conditions