>Hi Ed ,
>
>I have downloaded Struct.vcx as you suggested, and it seems like I've got it to work ( at least with some of my first DLL-calls).
>
>But here is one that I can't find any solution to. I'm sure this is an easy one for you, but it's definitely an impossible mission for me.
>
>It's obvious that the DRV_GetAddress-function expects the @DiValue parameter as string
>(due to my VFP DLL-declaration).
>
>If I understand the VB decaration of DRV_GetAddress it can handle "Any" type of parameter ?
>How do I achieve this with VFP ?
There's no variant type to pass; you need to pass a pre-sized buffer that's large enough to hold whatever return is coming back, so it's a safe assumption that an empty string is not going to work. An lpVoid is often used to pass back a function pointer or a pointer to an array of char. I have no idea what's coming back, but if it's a pointer to a function, it's not usable within VFP directly. You're going to have to figure it out for yourself.
>
>
>*VB declaration:
>*Declare Function DRV_GetAddress Lib "adsapi32.dll" (lpVoid As Any) As Long
>
>*My VFP declaration:
>DECLARE INTEGER DRV_GetAddress IN adsapi32.dll ;
> STRING @ lpVoid
>
>**************************
>*The following works:
>
>STORE 0 TO tt
>STORE "" TO tempStr, tmpStruct
>
>PT_DEVLIST = CreateObject( "MyStruct" )
>
> tmpStruct = PT_DEVLIST.GetString()
>
> tt = DRV_GetAddress(@ tmpStruct ) && tt gets a value like 41656200
>
>*** If I understand this right tt is the value of the address for variable tmpstruct in memory ?
>
You're going to have to read the docs, since I don't know what the return from the API call will be. A pointer to the location of a string is pretty worthless, since VFP can readjust the location of something allocated in string space at will; this is why I use CLSHEAP for static allocations.