C#

Fermé
nybibi Messages postés 5 Date d'inscription vendredi 7 décembre 2007 Statut Membre Dernière intervention 11 décembre 2007 - 10 déc. 2007 à 19:57
Lutinore Messages postés 3246 Date d'inscription lundi 25 avril 2005 Statut Membre Dernière intervention 27 octobre 2012 - 11 déc. 2007 à 00:34
Comment définir le paramètre d'une fonction d'une dll sachant que ce paramètre n'est pas défini dans la source du langage. Je m'explique, pour mon appli, j'ai importer ma dll sans aucun soucis avec c# et j'ai pu faire appel à certaines fonctions de cette dll après les avoir déclarer comme suit
[
DllImport(
"pulsestar")]

public
extern
static
int psOpenPort(
ushort a,
Int32 b,
bool c);

mais l'une d'entre elle a comme paramètre "ConfigStruct" qui n'existe pas bien entendu dans la source du langage c#
[
DllImport(
"pulsestar")]

public
extern
static
int psWakeProbe(ConfigStruct
);

Et sa définition dans le fichier h que m'a adressé le constructeur est la suivante
typedef

struct
 {

char internal_id[15];
// read only
char user_info[17];
// read/write
uchar config_data[32];
// read/write
uchar probe_time[20];
// read/write "mm/dd/yyyy hh:mm:ss" format
uchar product_id;
// read only
uchar sw_version;
// read only
uchar hw_version;
// read only
ulong battery_voltage;
// read only
ulong next_event_addr;
// read only
ulong events_since_reset;
// read/write (reset to 0, clears memory)
uchar vib_duration;
// read/write
uchar vib_intensity;
// read/write
uchar rep_read_delay;
// read/write
uchar irda_trigger_count;
// read/write
uchar irda_pause;
// read/write
uchar irda_duration;
// read/write
ulong low_bat_threshold;
// read/write
BOOLEAN irda_short_enable;
// read/write
BOOLEAN data_read_enable;
// read/write
} ConfigStruct;
// The following masks should be used in psWriteConfig() to specify
// which fields in the ConfigStruct are valid.

#define

USER_INFO_MASK 0x0001

#define CONFIG_DATA_MASK 0x0002

#define REALTIME_CLOCK_MASK 0x0004

#define VIB_DURATION_MASK 0x0008

#define VIB_INTENSITY_MASK 0x0010

#define REP_READ_DELAY_MASK 0x0020

#define IRDA_TRIGGER_COUNT_MASK 0x0040

#define IRDA_PAUSE_MASK 0x0080

#define IRDA_DURATION_MASK 0x0100

#define BAT_THRESHOLD_MASK 0x0200

#define IRDA_SHORT_ENABLE_MASK 0x0400

#define DATA_READ_ENABLE_MASK 0x0800

#define IRDA_LED_FLASH_MASK 0x1000

#define ALL_MASK 0x1FFF

Cependant j'ai essayé pas mal de trucs mais je n'arrive pas à créer ce paramètre afin de le définir dans ma fonction comme
dans le point h. Quelqun aurait il une solution à me proposer s v p?

1 réponse

Lutinore Messages postés 3246 Date d'inscription lundi 25 avril 2005 Statut Membre Dernière intervention 27 octobre 2012 41
11 déc. 2007 à 00:34
Ne pose pas 3 fois la même question dans la journée stp.. tu as des réponses dans tes messages précédents :

http://www.csharpfr.com/infomsg_CODE_1046862.aspx#1



http://www.csharpfr.com/infomsg_DLL-MISE-PLACE-APPLI_1046596.aspx#3
0
Rejoignez-nous