Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing Structures to DLLs?
Message
 
À
17/12/1997 18:41:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00066580
Message ID:
00067972
Vues:
26
Well, in this case, it is actuall looking for a pointer to a structure. Then, once the function call is finished, the structure will have the proper info in it. I tried passing a reference to a string, but only the first item in the structure is saved to the string, in this case, prog_name. Here is the VFP define for that function...

DECLARE INTEGER Czar_disp_ver IN Czar32 ;
STRING cProg


And here is a C++ struct that was given in an example program...

/*
VERSION AND MODIFICATION STRUCTURE
*/
#define VER_DEF
typedef struct {
char czar_prog_nm[20];
char czar_ver_number[3];
char czar_mod_number[5];
char bczar_prog_nm[20];
char bczar_ver_number[3];
char bczar_mod_number[5];
char fxlib_prog_nm[20];
char fxlib_ver_number[3];
char fxlib_mod_number[5];
char datatype[15];
char compiler[6];
} VERSIONS;

Thanks for the help!





>It depends. In very rare cases, George's solution will work. Usually a string in a structure is in fact a pointer to a string and you need a 3rd party tool to handle this (like my Pointers class that you can download from the Files section).
>
>Can you post the structure definition in C/C++ so I can tell you how to handle it?
>
>Vlad
>
>>>I am working with a DLL that expects to be passed a structure or reference to a structure for many of the functions. I've tried passing a string or array instead without luck. How can you pass a structure from VFP?
>>
>>I've been playing with this some more and just can't get it to work. For example, one function expects to be passed a reference to a structure with two items in the structure: program name, of type string, and program version of type integer. In VB it would look something like...
>>
>>Type VERSIONS_REC
>> Prog_name AS String * 20
>> Prog_ver AS Integer
>>End Type
>>
>>So, the function would return the program name and program version to that structure. I've tried passing just a string value, but the DLL only returns the first item in the structure to the string. I've also tried passing an array, but get data-type mismatch errors for these. I don't have any other ideas. Anyone?

Michael G. Emmons
memmons@nc.rr.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform