conctx_t = record > sys_name: array [0..63] of Char; > usr_name: array [0..23] of Char; > jed_addr: array [0..15] of Char; > jed_type: array [0..7] of Char; > jed_opis: array [0..63] of Char; > usr_opis: array [0..63] of Char; > end;>Call of function:
int TLI_getCtx ( int handle, conctx_t* ctx )>Size of struct = 252 (SizeOfFunction w Delphi get the required size of this structure)
FUNCTION getStruc >LPARAMETERS tnHandle >DECLARE INTEGER HeapCreate IN Win32API; > INTEGER dwOptions, INTEGER dwInitialSize,; > INTEGER dwMaxSize >DECLARE INTEGER HeapAlloc IN Win32API; > INTEGER hHeap, INTEGER dwFlags, INTEGER dwBytes >DECLARE lstrcpy IN Win32API; > STRING @lpstring1, INTEGER lpstring2 >DECLARE INTEGER HeapFree IN Win32API; > INTEGER hHeap, INTEGER dwFlags, INTEGER lpMem >DECLARE HeapDestroy IN Win32API; > INTEGER hHeap > >DECLARE INTEGER TLI_getCtx IN TL_ILIB.DLL; > Integer @handle,; > Integer @conctx_t > >lnheaphandle = HeapCreate(0, 4096, 0) >IF lnheaphandle # 0 >* save the required size of the structure > lnsize = 252 >* Get a pointer to an address > lnheap = HeapAlloc(lnheaphandle, 0, lnsize) >* Get the information into the structure >* in delphi is TF_TLI_getCtx = function (handle: Integer; ctx: pconctx_t): Integer; stdcall; >* conctx_t = record >* sys_name: array [0..63] of Char; >* usr_name: array [0..23] of Char; >* jed_addr: array [0..15] of Char; >* jed_type: array [0..7] of Char; >* jed_opis: array [0..63] of Char; >* usr_opis: array [0..63] of Char; >* end; > > TLI_getCtx(lnHandle,lnHeap) >* Copy the structure to VFP memory >* In order to get the pointer to the string > lcstruct = SYS(2600, lnheap, lnsize) > lnptr = INT(val(SUBSTR(lcstruct, 5, 4))) >* Initialize the buffer to receive the Driver >* to MAX_PATH > lcresult = SPACE(240) > = lstrcpy(@lcresult, lnptr) >* Remove the trailing CHR(0) > lcresult = LEFT(lcresult, AT(CHR(0), lcresult) - 1) >* Free the heap > = HeapFree(lnheaphandle, 0, lnheap) >* Clean up by destorying the handle >* to the heap > = HeapDestroy(lnheaphandle) >ENDIF >>Please help me !!!!