DllCall to ATMAPI.DLL Info
Keywords: ATMAPI.DLL
Question:
I'm trying assign a string value to a string variable, inside a DLL. After the DLL is called, the string should contain the contents of a screen.*********************************************************** cScreen = BINARYALLOC( 1920 ) ; - Already tried using cScreen = STRFILL( " ", 1920 ) - GOSUB LOGINTOTSO RETURN :LOGINTOTSO hWnd = DLLHWND( "" ) hDll = DLLLOAD( "ATMAPI.DLL" ) xResult = DLLCALL( hDll, word:"ATMRESETSYSTEM", word:hWnd ) xResult = DLLCALL( hDll, word:"ATMSETPARAMETER", word:hWnd, word:3, word:2, lpstr:"@" ) xResult = DLLCALL( hDll, word:"ATMCONNECTSESSION", word:hWnd, lpstr:"A" ) GOSUB ISCMDSHELL ... ... RETURN ; - Here's the line with the problem. xResult = DLLCALL( hDll, word:"ATMGETSTRING", word:hWnd, word:0, word:0, lpstr:cScreen, word:1921 ) ... ... RETURN ***********************************************************These are the parameters:hWnd Handle to app. Row Starting row position of string to copy from host session. Col Starting column position "" Buffer String provided by the caller used as destination when copying a string from the target session. BufferLength An integer defining the number of characters to copy plus one extra character.The function returns a 65534, which I believe is equivalent to a -2. This represents an invalid parameter. The problem, obviously, is that I don't know how to pass a variable to a DLL by reference. Is there a way to do this?Answer:
- Use LPBINARY to pass binary buffer.
- Add BinaryEODSet(cScreen,1920) after BinaryAlloc
- Is this a 32 bit DLL (are you using 32 bit WinBatch) If so, change all WORD: to LONG:
Here's the line with the problem.
xResult = DLLCALL( hDll, word:"ATMGETSTRING", word:hWnd, word:0, word:0, LPBINARY:cScreen, word:1921 ) ...Question (continued):
It's a 16-bit DLL. Roger on the LPBINARY and BinaryEODSet. I'll try it, thanks.
Article ID: W12716Filename: DllCall to ATMAPI.DLL Info.txt