Hallo @ all
hab da n kleines Problemchen...
Ich versuche eine DLL anzusprechen mit einer Struktur.
ABER irgendwie glaube ich, funktioniert mein dllcall nicht, weis aber nicht, was ich da anderst machen soll.
hier mein Script
also wenn irgend jemand was auf fällt ... einfach mal los schreiben ..
DANKE !!
Spoiler anzeigen
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.1
Author: myName
Script Function:
NIdll ansprechen
#ce ----------------------------------------------------------------------------
#cs
#define BUFFERSIZE 256
#define NumberIOs 24
typedef struct
{
char name[BUFFERSIZE]; // Name der Karte
char port0[BUFFERSIZE]; // Name von Port0
char port1[BUFFERSIZE]; // Name von Port1
char port2[BUFFERSIZE]; // Name von Port2
BOOL ioPort0; // Input (TRUE) oder Output (FALSE)
BOOL ioPort1; // Input (TRUE) oder Output (FALSE)
BOOL ioPort2; // Input (TRUE) oder Output (FALSE)
int handle[NumberIOs]; // Maximal pro IO ein Handle
BOOL bits[NumberIOs]; // Eine Karte hat NumberIOs Bits.
} NICard;
;#########################################################
how to use:
niDll:
NI USB-Karten,
init_NICard (NICard *nicard, +Std)
öffnet die Handle für die einzelnen Ports.
Hierbei wird unterschieden zwischen Input/Output-Ports
Für einen Input-Port wird ein Handle aufgemacht,
für einen Output-Port wird für jedes Bit ein Handle aufgemacht,
so dass auch jedes Bit einzeln geschrieben werden kann.
write_NICard_bit (NICard *nicard, int bit, +Std)
schreibt ein einzelnes bit,
read_NICard (NICard *nicard, +Std)
liest alle Ports auf einmal und
shutdown_NICard (NICard *nicard, +Std)
schließt alle Handle.
genauer :
int init_NICard (NICard *nicard, char* reportText, short* errorOccured, long* errorCode, char* errorMsg);
int read_NICard (NICard *nicard, char* reportText, short* errorOccured, long* errorCode, char* errorMsg);
int write_NICard_bit (NICard *nicard, int bit, char* reportText, short* errorOccured, long* errorCode, char* errorMsg);
int shutdown_NICard (NICard *nicard, char* reportText, short* errorOccured, long* errorCode, char* errorMsg);
#ce
; strukturparameter
$str = "char name[256];char port0[256];char port1[256];char port2[256];BOOL ioPort0; BOOL ioPORT1;BOOL ioPORT2;int handle[24];BOOL bits[24]"
$nidll_Strukt = DllStructCreate($str) ; struktur generieren
DllStructSetData($nidll_Strukt,"name","test")
DllStructSetData($nidll_Strukt,"port0","A")
DllStructSetData($nidll_Strukt,"port1","B")
DllStructSetData($nidll_Strukt,"port2","C")
DllStructSetData($nidll_Strukt,"ioPort0",True)
DllStructSetData($nidll_Strukt,"ioPort1",True)
DllStructSetData($nidll_Strukt,"ioPort2",True)
DllStructSetData($nidll_Strukt,"handle",3)
DllStructSetData($nidll_Strukt,"bits",0)
; dll öffnen
$niDll_dll = DllOpen("niDll.dll")
;result = DllCall ( "dll ","return type"," function " , type1 , param1 )
$result = DllCall ( $niDll_dll , "int" ,"init_NICard", "ptr" ,DllStructGetPtr($nidll_Strukt) )
; close
DllClose($niDll_dll)
$nidll_Strukt = 0 ; struktur löschen
ich suche grad noch free-webspace, dann poste ich noch die zugehörige dll
hier die DLL -> http://uploaded.to/file/m5b7sn