Information générale
Catégorie:
Fonctions Windows API
>>>Here is the API I need to call. Anyway I've done a .DLL in the meantime, but I'd like to know if it's possible to call it using only VFP.
>>>
>>>DWORD WNetAddConnection2(LPNETSOURCE lpNetSource, LPSTR lpPassword, LPSTR lpUserName, DWORD fdwConnection)
>>>
>>>LPNETSOURCE defined as follow
>>>{
>>>dwType /* Integer, no problem */
>>>lpLocalName /* Points to a string */
>>>lpRemoteName /* Points to a string */
>>>and so on ..
>>>}
>>
>>This is not the real declaration of NETRESOURCE in Win32API.
>>
>>>So, I could pass a string as lpUserName or lpPassord, but how do I pass lpRemoteName since it is a pointer to a string within a structure.
>>
>>As already said, you must build a string to simulate the structure. But if I understand you well, the problem is that you don't know how to take the address (pointer) of a string in VFP, isn't it?
>>
>>This is a really good question. I think you can't do it in VFP! Unless you write a DLL function that will take a variable as parameter (pass it by reference) and will return its address (pointer). But this is not VFP only.
>>
>>Please let me know if you found anything better.
>>
>>>Can I construnct a Fox string as "0UserNamePassord...", I think I can not do that, can I?
>>
>>I don't understand what you mean. Can you be more specific?
>>
>>Vlad
>
>Hi,
> Have you tried passing null terminated string itself, I mean
>"AAAA\0","BBBB\0". Just an idea, I never tried it.
You can pass "AAAA"+chr(0) if you need to pass a null terminated string.
But for this particular API function, you must pass a pointer to a structure. In the structure you have some pointers to null terminated strings. Usually, you can build a string to simulate the structure. But I don't know how to take the pointer to string to put it into this structure-string.
Vlad
>
>Narendra
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement