Sign in to follow this  
Followers 0
Kulotron

Not getting Buffer on Mainframe Screen with ehllapi.dll

3 posts in this topic

I am trying to read the contents in an mainframe terminal that is embedded in an IE window. It is a RUMBA terminal, and I am doing DLLCALLs to the ehllapi32.dll.

I don't get any errors when I try to connect with WD_ConnectPS, and I get no errors when I try to copy the presentation screen with WD_CopyPSToString

but the buffer as far as I can see is empty. Could you go over my code and see if I am missing something?

Thanks

Global $tPOINT = DllStructCreate("int X;int Y")
    DllStructSetData($tPOINT, 'X', 400); 
    DllStructSetData($tPOINT, 'Y', 400); 
    $hWnd = _WinAPI_WindowFromPoint($tPOINT)
     
    $mydll = DllOpen("ehlapi32.dll")
    $connect = DllCall($mydll,"word","WD_ConnectPS","hwnd", $hWnd, "str","A")
    If @error Then
        MsgBox(4096, "Error", "Could not find the correct window")
    ElseIf ($connect = 1) Then
        MsgBox(4096, "Error", "Could not connect to PS")
    Else
        $buffer = DllStructCreate("char[3564]")
        $position = 1
        $copyfunc = DllCall($mydll, "word", "WD_CopyPSToString", "hwnd", $hWnd, "word",$position, "ptr",DllStructGetPtr($buffer), "word", DllStructGetSize($buffer))
        ;WD_CopyPSToString(hinstance: LongInt; Position: Integer; Buffer: String; Length: Integer): Integer; stdcall; external ehlapi32 name 'WD_CopyPSToString';
        ;Maximum size of buffer is 3564
        If @error Then
            MsgBox(4096, "Error", "Could not copy PS. Return:"&$copyfunc)
        EndIf
        ClipPut(DllStructGetData($buffer,1))
        Msgbox(0,"Result","Return:"&$copyfunc&@LF&DllStructGetData($buffer,1))
                
    EndIf
    DllClose($mydll)

Share this post


Link to post
Share on other sites



To start with, DllCall() always returns an array, so $connect and $copyfunc are being used wrong.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

To start with, DllCall() always returns an array, so $connect and $copyfunc are being used wrong.

:)

Thank you. I see that now. I'll adjust my code and see if I can get the buffer.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0