Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Record structure in VFP
Message
De
08/07/2005 16:34:19
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01030631
Message ID:
01030730
Vues:
13
http://fox.wikis.com/wc.dll?Wiki~ApiStructureClass~VFP

>I have big problem. I must handle a few of record structure in WinApi function.
>Simple example:
>
 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)
>
>I try something like this (but this don't work :( )
>
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 !!!!
>
>Andrzej Multan
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform