1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. Greenhorn

Beiträge von Greenhorn

  • Array Syntax Frage

    • Greenhorn
    • 14. November 2008 um 12:50

    Moinsen,

    das letzte Anführungszeichen ist zuviel ...

    Spoiler anzeigen
    [autoit]

    #include <Process.au3>
    Const $dateiname = "c:\TONERSTAND\Kyocera FS3900DN.txt"
    Const $inifile = "D:\AUTOIT\Tonerstandplugin.ini"
    $i = 0
    $y = 1
    $x = 0
    $Section = IniReadSectionNames ($inifile)
    $maxArray = $Section[0]
    Dim $DruckerTyp[$maxArray]
    Dim $Tonerartikel[$maxArray]
    Dim $Tonermeldebestand[$maxArray]
    Dim $Tonerbestand[$maxArray]

    [/autoit] [autoit][/autoit] [autoit]

    While $i < $maxArray
    $DruckerTyp[$i] = IniRead($inifile, $Section[$y], "DruckerTyp","")
    $Tonerartikel[$i] = IniRead($inifile, $Section[$y], "Tonerartikel","")
    $Tonermeldebestand[$i] = IniRead($inifile, $Section[$y], "Tonermeldebestand","")
    $Tonerbestand[$i] = IniRead($inifile, $Section[$y], "Tonerbestand","")
    $i += 1
    $y += 1
    WEnd
    $i = 0
    While $i < $maxArray
    If $Tonerbestand[$i] <= $Tonermeldebestand[$i] Then
    $x += 1
    EndIf
    WEnd
    Dim $Meldungen[$x]
    $i = 0
    $y = 0
    While $i < $maxArray
    If $Tonerbestand[$i] <= $Tonermeldebestand[$i] Then
    $Meldungen[$x] = " Toner Lagerbestand Kritisch || "& _
    $DruckerTyp[$i]& ": "&$Tonerartikel[$i]& _
    " || Aktueller Stand: "&$Tonerbestand[$i]
    $y += 1
    $i += 1
    Else
    $i += 1
    EndIf
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit]


    Wenn Du die Anführungszeichen mit ausgeben möchtest, dann verpacke sie in einfache Anführungszeichen. ;)

    EDIT:
    Außerdem ist $Meldungen[$x] auch nicht das was Du möchtest, glaube ich, sollte es nicht $y sein ???


    LG
    Greenhorn

  • ImageList für ListView

    • Greenhorn
    • 13. November 2008 um 22:43

    Moin,

    meinst Du vielleicht _GUICtrlListView_SetItemImage () ?


    LG
    Greenhorn

  • Happy Birthday Xeno

    • Greenhorn
    • 13. November 2008 um 20:36

    Jo,

    da Habe ich wohl auch verschlafen ... :S

    Herzlichen Glückwunsch nachträglich zum Geburtstag und gute Gesundheit, mein Gutster ! :!:


    LG
    Greenhorn

  • Probleme mit DllCall

    • Greenhorn
    • 13. November 2008 um 20:20

    Moin Andy, mein Bester,

    natürlich hast Du Recht, daß 'ptr'(void*) genauso gut funktioniert wie 'ubyte*', solange ich den richtigen Datentyp an DllCall() übergebe. ;)
    Denn AutoIt überprüft wirklich nicht um welchen Datentyp es sich genau handelt.

    Zitat

    * | Add * to the end of another type to pass it by reference. For example "int*" passes a pointer to an "int" type.


    Hier wird nicht das Objekt selbst übergeben sondern ein Zeiger auf ein Objekt.
    Das ist ähnlich wie ByRef, der Unterschied ist aber, das der Funktionsparameter ein Zeiger ist und nicht das Objekt selbst ...

    Beispiele:

    Spoiler anzeigen
    Code
    // Funktionsdeklaration
    int DoSomething (  int* argument ) ; // int* = Zeiger auf int
    
    
    int main ()
    {
        int i = 255 ;
    
    
        int *pi = &i ; // pi enthält die Adresse von i
    
    
        // Zeiger mit der Adresse von i an die Funktion übergeben
        DoSomething ( pi ) ; 
    
    
        // Das gleiche kann ich auch so erreichen ...
        DoSomething ( &i ) ;  // Auch hier übergebe ich die Adresse von i an die Funktion,
                              // indem ich den Adressoperator '&' der Objektvariable voranstelle
        return 0 ;
    }
    
    
    // Funktionsdefinition
    int DoSomething ( int* argument )
    {
        // argument ist eine Kopie des übergebenen Zeigers
        ++*argument ; // Das Objekt auf das argument verweist (i) wird 
                      // um eins inkrementiert
    return 0 ;
    }
    Alles anzeigen


    Wenn ich ein Objekt per Referenz an eine Funktion übergeben muss, sieht die Funktionsdeklaration wie folgt aus:

    Spoiler anzeigen
    Code
    // Funktionsdeklaration
    int DoSomething ( int& argument ) ; // int& = Referenz auf int
    
    
    int main ()
    {
        int i  = 0 ;
    
    
        DoSomething ( i ) ; // Syntax wie bei Übergabe per Wert
        return 0 ;
    }
    
    
    // Funktionsdefinition
    int DoSomething ( int& argument )
    {
        return ++argument ; // Das Objekt in argument (i) wird 
                            // um eins inkrementiert
        return 0 ;
    }
    Alles anzeigen


    Letzteres wäre in AutoIt wie folgt definiert ...

    Spoiler anzeigen
    [autoit]


    Func DoSomething ( ByRef $argument )
    $argument += 1
    Return 0
    EndFunc

    [/autoit]

    Wie meinst Du das "Den Pointer bekommst du in AutoIt nirgends." ? ?(

    LG
    Greenhorn

  • Probleme mit DllCall

    • Greenhorn
    • 12. November 2008 um 19:16
    Zitat von progandy

    Also, die HardDllCommand ist immer noch nicht richtig, denke ich. der dritte Parameter, pBlock muss vom Typ PTR sein. diesem wird der Pointer zu der DllStruct übergeben.
    ubyte* bedeutet: Pointer zu einem UByte. Das Ubyte wird in DllCall als Wert angegeben und dann der Pointer dazu an die DLL gesendet.
    ptr bedeutet: Pointer zu der übergebenen DLLStruktur, hier ein array von ubytes :)

    ptr ist ein VOID* ! Also ein Zeiger vom Typ void.
    ubyte* ist ein Zeiger auf eine ubyte Variable.
    Also stimmt es schon so, die Funktion funzt ja in der letzten Version.

    In C/C++ müssen die Datentypen übereinstimmen, d.h. explizit deklariert werden.
    Ein long* kann nur auf einen long zeigen und nicht auf einen char ...
    Ob ein Zeiger auf ein Array verweist oder eine einfache Variable spielt keine Rolle.
    http://www.highscore.de/cpp/einfuehrung/variablen.html

    AutoIt wandelt die Typen manchmal automatisch um, aber verlassen würde ich mich nicht immer drauf ...


    LG
    Greenhorn

  • wie nutzt man Listview(Item) performant / besser ?

    • Greenhorn
    • 11. November 2008 um 23:57

    Moin,

    versuch es doch einmal anders herum ... ;)

    [autoit]

    $List1 = GUICtrlCreateListview("Nr.|1|2|3|4|5|6|7|8|9|10|11|12|13", 40, 88, 529, 240)

    [/autoit][autoit][/autoit][autoit]

    Func sort_chanels($channel_file)

    Local $channels,

    $hfile = FileOpen ($channel_file, 0)
    $str = FileRead ($hfile)
    If StringInStr ($str, '|') Then
    $str = StringReplace ($str, '|', '-') ; D 1 - 06|45 = D 1 - 06-45
    EndIf
    $str = StringReplace ($str, ':', '|') ; ... der umgekehrte Weg ...
    $channels = StringSplit ($str, @CRLF, 1)

    For $i = 1 to $channels[0][0]
    If StringLeft($channels[$i],1) == "|" Then
    $channels[$i] = $i & $channels[$i] & "||||||||||||"
    Else
    $channels[$i] = $i & "|" & $channels[$i]
    EndIf
    GUICtrlCreateListViewItem($channels[$i], $List1)
    Next
    FileClose ($hfile)
    EndFunc

    [/autoit]


    LG
    Greenhorn

  • Probleme mit DllCall

    • Greenhorn
    • 11. November 2008 um 21:22

    Alternative: Schlank und portabel für den USB Stick ...
    http://www.codeblocks.org/


    LG
    Greenhorn

  • In unterordnern nach datein suchen + auswählen und umbenennen

    • Greenhorn
    • 11. November 2008 um 20:44

    Moin,

    der Fensterstil WS_HSCROLL funktioniert bei einer Listbox komischerweise nicht ...

    Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    #include <ListboxConstants.au3>
    #include <File.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $WS_EX_COMPOSITED = 0x2000000 ; Gegen "Flackern"

    [/autoit] [autoit][/autoit] [autoit]

    $Form1 = GUICreate ("Dateienfinder", 316, 289, 269, 154, $WS_OVERLAPPEDWINDOW, $WS_EX_COMPOSITED)
    GUICtrlSetState (-1,$GUI_SHOW)
    $List1 = GUICtrlCreateList ("", 5, 30, 129, 216, BitOR ($GUI_SS_DEFAULT_LIST, $WS_HSCROLL))
    $List2 = GUICtrlCreateList ("", 175, 30, 129, 216, BitOR ($GUI_SS_DEFAULT_LIST, $WS_HSCROLL))
    $Button5 = GUICtrlCreateButton (">", 138, 93, 34, 34, 0)
    GUICtrlSetFont (-1, 16, 800, 0)
    $Button6 = GUICtrlCreateButton ("<", 138, 143, 34, 34, 0)
    GUICtrlSetFont (-1, 16, 800, 0)
    $Button7 = GUICtrlCreateButton ("Hilfe", 62, 250, 75, 25, 0)
    $Button8 = GUICtrlCreateButton ("Beenden", 174, 250, 75, 25, 0)
    ;$Pfad = GUICtrlCreateLabel ("D:\Dateifinder\Test\", 6, 5, 298, 18)
    $Pfad = GUICtrlCreateLabel ("C:\WINDOWS\", 6, 5, 298, 18)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    ; Shows the filenames of all files in the current directory.
    $Ordner = FileFindFirstFile(GUICtrlRead($Pfad) & "*")

    [/autoit] [autoit][/autoit] [autoit]

    ; Check if the search was successful
    If $Ordner = -1 Then
    MsgBox(0, "Fehler", "Keine Pfade/Dateien entsprechen den Suchkriterien")
    Exit
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    While 1

    ;$UOrdner = FileFindNextFile ($Ordner)
    ;$Datei = FileFindFirstFile ($Pfad & $UOrdner & "\")
    $UDatei = FileFindNextFile ($Ordner);, "*.sg1")
    ;~ $Datei = FileFindNextFile($UOrdner)
    If @error Then ExitLoop
    ;~
    GUICtrlSetData ($List1, $UDatei)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    While True

    Switch GUIGetMsg ( )
    Case -3
    ExitLoop
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    ; Close the search handle
    FileClose($Ordner)
    ;FileClose($Datei)

    [/autoit]

    Aber Du kannst ja das Fenster weiter aufziehen. Oder Du nimmst ein Edit Steuerelement ...


    LG
    Greenhorn

  • Autoit lernen.

    • Greenhorn
    • 11. November 2008 um 20:10

    Habe mich mit unbeaufsichtigten Installationen beschäftigt - bin durch das c't Sonderheft drauf gestoßen -, und bin dabei auf AutoIt aufmerksam geworden.


    LG
    Greenhorn

  • Probleme mit DllCall

    • Greenhorn
    • 11. November 2008 um 19:42

    Moin,

    läuft es denn nun ?


    LG
    Greenhorn

  • Probleme mit DllCall

    • Greenhorn
    • 10. November 2008 um 20:38

    Die Treiber sind installiert ?
    SIUDI.SYS
    SIUDI-EC.SYS
    SIUDI-IN.SYS

    Die DLL registriert ?
    http://www.pcdmx.de/ger/hardware/usbdmx1/install.htm

    Zitat von DjBasslord

    Hm, das cdecl scheint ja ganz gut zu funktionieren :) , aber was macht das denn?


    http://de.wikipedia.org/wiki/Cdecl

    LG
    Greenhorn

  • Menü mit "GUI"

    • Greenhorn
    • 10. November 2008 um 20:00

    Du meinst sicher so eine Art Installationsmenü, nicht ?


    Gruß
    Greenhorn

  • Probleme mit DllCall

    • Greenhorn
    • 10. November 2008 um 19:35

    So, nun läuft es ! Es fehlte ':cdecl' ...

    Also, die Struktur des Puffers als ubyte(unsigned char = 0 bis 255), den Funktionsparameter als ubyte*, so ist es korrekt. :)

    Bei mir läuft das Skript aber nur bis zum ersten Aufruf und gibt DHE_ERROR_COMMAND zurück, bei dir müsste es aber schon anders sein ...

    Spoiler anzeigen
    [autoit]


    ; Konstanten

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $DHC_SIUDI0 = 0 ; COMMAND
    Global Const $DHC_SIUDI1 = 100 ; COMMAND
    Global Const $DHC_SIUDI2 = 200 ; COMMAND
    Global Const $DHC_SIUDI3 = 300 ; COMMAND
    Global Const $DHC_SIUDI4 = 400 ; COMMAND
    Global Const $DHC_SIUDI5 = 500 ; COMMAND
    Global Const $DHC_SIUDI6 = 600 ; COMMAND
    Global Const $DHC_SIUDI7 = 700 ; COMMAND
    Global Const $DHC_SIUDI8 = 800 ; COMMAND
    Global Const $DHC_SIUDI9 = 900 ; COMMAND

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $DHC_OPEN = 1 ; COMMAND
    Global Const $DHC_CLOSE = 2 ; COMMAND
    Global Const $DHC_DMXOUTOFF = 3 ; COMMAND
    Global Const $DHC_DMXOUT = 4 ; COMMAND
    Global Const $DHC_PORTREAD = 5 ; COMMAND
    Global Const $DHC_PORTCONFIG = 6 ; COMMAND
    Global Const $DHC_VERSION = 7 ; COMMAND
    Global Const $DHC_DMXIN = 8 ; COMMAND

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $DHC_RESET = 11 ; COMMAND
    Global Const $DHC_DEBUG_OPEN = 12 ; COMMAND
    Global Const $DHC_DEBUG_CLOSE = 13 ; COMMAND

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $DHC_WRITEMEMORY = 21 ; COMMAND
    Global Const $DHC_READMEMORY = 22 ; COMMAND
    Global Const $DHC_SIZEMEMORY = 23 ; COMMAND

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $DHC_3DWRITE = 25 ; COMMAND
    Global Const $DHC_3DREAD = 26 ; COMMAND
    Global Const $DHC_MMWRITE = 27 ; COMMAND
    Global Const $DHC_MMREAD = 28 ; COMMAND

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $DHC_TRANSPORT = 30 ; COMMAND
    Global Const $DHP_TRANSPORT_MODEALW = 1 ; PARAM
    Global Const $DHP_TRANSPORT_MODEALW32 = 2 ; PARAM
    Global Const $DHP_TRANSPORT_MODEOPT = 3 ; PARAM DEFAULT
    Global Const $DHP_TRANSPORT_MODEOPT32 = 4 ; PARAM

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $DHC_SERIALNREAD = 47 ; COMMAND
    Global Const $DHC_SERIALNWRITE = 48 ; COMMAND

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $DHE_OK = 1 ; RETURN NO ERROR
    Global Const $DHE_NOTHINGTODO = 2 ; RETURN NO ERROR

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $DHE_ERROR_COMMAND = -1 ; RETURN ERROR
    Global Const $DHE_ERROR_NOTOPEN = -2 ; RETURN ERROR
    Global Const $DHE_DMXOUT_PACKWRITE = -1000 ; RETURN ERROR -1005 = ERROR_ACCESS_DENIED -1023 = ERROR_CRC
    Global Const $DHE_DMXOUT_PACKREAD = -1100 ; RETURN ERROR

    [/autoit] [autoit][/autoit] [autoit]

    ; Dll öffnen
    Global Const $dhcDll = DllOpen ('DasHard.dll')

    [/autoit] [autoit][/autoit] [autoit]

    Opt ('OnExitFunc', 'Terminate')

    [/autoit] [autoit][/autoit] [autoit]

    ; Dll schließen
    Func Terminate ( )

    DllClose ($dhcDll)

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ; *** Dll Funktion ***
    Func HardDllCommand ($iCommand, $iParam, $pBloc)

    $aRes = DllCall ($dhcDll, 'int:cdecl', 'DasHardCommand', _
    'int', $iCommand, _
    'int', $iParam, _
    'ubyte*', $pBloc)
    Return $aRes[0]

    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; *** Open the interface when your application start :

    [/autoit] [autoit][/autoit] [autoit]

    Dim $v, $interface_open; // global
    ; Struktur für den Daten-Block erzeugen
    $dmxblock = DllStructCreate ('ubyte dmxblock[512]'); // global

    [/autoit] [autoit][/autoit] [autoit]

    $interface_open = HardDllCommand ($DHC_OPEN,0,0);
    switch $interface_open
    case $DHE_ERROR_NOTOPEN
    MsgBox (266256, 'DasHardCommand - Error', 'DHE_ERROR_NOTOPEN')
    case $DHE_ERROR_COMMAND
    MsgBox (266256, 'DasHardCommand - Error', 'DHE_ERROR_COMMAND')
    case $DHE_NOTHINGTODO
    MsgBox (266304, 'DasHardCommand - Info', 'DHE_NOTHINGTODO')
    case $DHE_OK
    MsgBox (266304, 'DasHardCommand - Info', 'DHE_OK')
    endswitch
    if ($interface_open > 0) then
    for $i = 1 to 512
    ; eigentlich unnötig, wie ProgAndy schon andeutete,
    ; aber ist ja nur ein Schreibtest ... ;)
    ConsoleWrite (DllStructSetData ($dmxblock, 'dmxblock', 0, $i) & @crlf);
    next
    $v = HardDllCommand ($DHC_DMXOUTOFF,0,0);
    endif
    ; Note :
    ; - When you open the interface, you don't know the state of the DMX output levels into the interface.
    ; It's why it's better to clean all DMX levels to be sure.

    [/autoit] [autoit][/autoit] [autoit]

    ; *** Send the DMX and read the PORT everytime :

    [/autoit] [autoit][/autoit] [autoit]

    Dim $v, $ports;
    if ($interface_open > 0) then
    $ports = HardDllCommand ($DHC_PORTREAD,0,0);
    $v = HardDllCommand ($DHC_DMXOUT, 512, DllStructGetPtr ($dmxblock, 'dmxblock')); evtl. 'dmxblock[0]' ...
    if ($v < 0) then
    $v = HardDllCommand ($DHC_CLOSE,0,0);
    $v = HardDllCommand ($DHC_OPEN,0,0);
    endif
    endif

    [/autoit] [autoit][/autoit] [autoit]

    ; Note :
    ; - When you use the DHC_DMXOUT command, the DLL analyses your DMX block.
    ; If there is no changes on the DMX levels, the function returns DHE_NOTHINGTODO and
    ; the DLL don't make a USB communication to save the CPU time of your computer.
    ; - After 6 seconds without USB communication, the USBDMX1 and interfaces go in stand alone mode
    ; (it's a nice feature, if the computer fails). It's why we propose to read the state of the
    ; port everytime to force a USB communication, with this, the interface do not go in stand alone mode.
    ; - If the DHC_DMXOUT command fails (for example, if the user unplug the USB interface !), you need
    ; to close and try to open again the interface.

    [/autoit] [autoit][/autoit] [autoit]

    ; *** Close the interface when your application finish :

    [/autoit] [autoit][/autoit] [autoit]

    Dim $v;
    if ($interface_open>0) then _
    $v = HardDllCommand ($DHC_CLOSE,0,0);

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    EDIT: Das Exit musste natürlich noch raus ...


    LG
    Greenhorn

  • Probleme mit DllCall

    • Greenhorn
    • 10. November 2008 um 17:58
    Zitat von DjBasslord

    Hm das Problem ist leider, dass ich noch nicht mal dazu komme, Daten zu senden, da ich das Interface noch nichtmal per DllCall öffnen kann, da sich Autoit dann verabschiedet -.-. Meine Vermutung liegt nun darin, dass das wohl vllt am Letzten Parameter liegen könnte. Später sollen dann Werte von 0 - 255 zum Interface gesendet werden.
    Ein Testskript habe ich soweit eig garnicht, weil ich von DllCalls überhaupt keine Ahnung habe. Aber ich denke mal, um zutesten ob das funktioiert muss man ja nicht das Interface haben, da die Dll dann 0 zurückliefert wenn das Interface nicht angeschloßen ist.
    Habe außerdem ncoh einwenig ein bisschen rumgesucht und noch ein bssl Code gefunden ==> http://karistouf.free.fr/dmxfreelab.htm
    greetz DJ

    0 bis 255, also ein unsigned char !

    Dann muss es damit klappen. Hast Du alle anderen Fehlerquellen ausgeschlossen, manchmal übersieht man das einfachste (ich spreche aus Erfahrung ) ...
    Wird die DLL geladen ?
    Was sind die Rückgabewerte von DllCall, Du hast die DHC_... Errorwerte zum überprüfen.


    LG
    Greenhorn

    p.s. muss kurz in den Topf gucken ... ;)

  • Probleme mit DllCall

    • Greenhorn
    • 10. November 2008 um 17:37

    OK, Forensik. :D

    Poste doch bitte mal dein Testskript und erkläre was für Daten in dem Block übertragen werden sollen, vielleicht kommen wir dann weiter ...


    LG
    Greenhorn

    p.s.: Das Szenario kommt mir bekannt vor ..., irgendwie ... :D

    Zitat von DjBasslord

    Hm das ist alles Käse mit der dämlichen Dll und Autoit, dass tuts vorne und hinten nicht -.-, bei uchar* gibt der DLLCall en Fehler wieder, und bei ubyte* hängt sich Autoit ganz auf und beendet sich :cursing:
    PS: das mit ptr funktioniert leider auch nicht, es wird immer "!>16:56:25 AutoIT3.exe ended.rc:-1073741819" in der Konsole ausgegeben...

  • Probleme mit DllCall

    • Greenhorn
    • 10. November 2008 um 16:42

    Ja, hast Recht. char, bzw. uchar gibt's nur in DllStructCreate() ...

    Dann nimm ubyte*, der Datentyp BYTE ist Microsoft Schnick-Schnack für char ...
    MWL.zip

    [autoit]

    ; *** Dll Funktion ***
    Func HardDllCommand ($iCommand, $iParam, $pBloc)

    $aRes = DllCall ($dhcDll, 'int', 'DasHardCommand', _
    'int', $iCommand, _
    'int', $iParam, _
    'ubyte*', $pBloc)
    Return $aRes[0]

    EndFunc

    [/autoit]

    EDIT:
    ProgAndy's variante könnte ebenso klappen, musst Du mal durchtesten ...

    LG
    Greenhorn

  • Probleme mit DllCall

    • Greenhorn
    • 10. November 2008 um 15:56
    Zitat von progandy

    Greenhorn: ich hab die DLL aus post #1 von diesem Thread genommen, du wohl die von der HP?


    Hast natürlich Recht, es ist DasHardCommand, jetzt komme ich ganz und gar durcheinander ... :D

    Also, bitte die Funktion umbenennen !

    [autoit]


    ; *** Dll Funktion ***
    Func HardDllCommand ($iCommand, $iParam, $pBloc)

    $aRes = DllCall ($dhcDll, 'int', 'DasHardCommand', _
    'int', $iCommand, _
    'int', $iParam, _
    'uchar*', $pBloc)
    Return $aRes[0]

    EndFunc

    [/autoit][autoit][/autoit][autoit][/autoit]

    Pause ...

    LG
    Greenhorn

  • Probleme mit DllCall

    • Greenhorn
    • 10. November 2008 um 15:48

    Ja, sehr verwirrend, das Ganze. :D

    Aber nun sollte es gehen, mal auf DjBasslord warten ...


    LG
    Greenhorn

  • Probleme mit DllCall

    • Greenhorn
    • 10. November 2008 um 12:33

    Moin,

    Zitat von progandy

    Name der Funktion in der Dll ist: _DasHardCommand@12 (steht bei Alias vom VB-Code :) )

    Das ist die Compiler-Signatur der Funktion. ;)
    http://de.wikipedia.org/wiki/Signatur_(Programmierung)

    Zitat von Mario2323

    apropo parameter. wie findet man parameter bei einer dll raus?

    Nun, entweder sind sie dokumentiert oder es sieht schlecht aus.
    Mit Dependency Walker kann man einiges in Erfahrung bringen, aber das genügt meist nicht ...

    EDIT:
    In den Beispielen heißt die Funktion komischerweise anders, vielleicht ist das der Fehler ...

    Ich habe dir mal die Beispiele übersetzt, aber nicht getestet ...

    Spoiler anzeigen
    [autoit]


    ; Konstanten

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $DHC_SIUDI0 = 0 ; COMMAND
    Global Const $DHC_SIUDI1 = 100 ; COMMAND
    Global Const $DHC_SIUDI2 = 200 ; COMMAND
    Global Const $DHC_SIUDI3 = 300 ; COMMAND
    Global Const $DHC_SIUDI4 = 400 ; COMMAND
    Global Const $DHC_SIUDI5 = 500 ; COMMAND
    Global Const $DHC_SIUDI6 = 600 ; COMMAND
    Global Const $DHC_SIUDI7 = 700 ; COMMAND
    Global Const $DHC_SIUDI8 = 800 ; COMMAND
    Global Const $DHC_SIUDI9 = 900 ; COMMAND

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $DHC_OPEN = 1 ; COMMAND
    Global Const $DHC_CLOSE = 2 ; COMMAND
    Global Const $DHC_DMXOUTOFF = 3 ; COMMAND
    Global Const $DHC_DMXOUT = 4 ; COMMAND
    Global Const $DHC_PORTREAD = 5 ; COMMAND
    Global Const $DHC_PORTCONFIG = 6 ; COMMAND
    Global Const $DHC_VERSION = 7 ; COMMAND
    Global Const $DHC_DMXIN = 8 ; COMMAND

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $DHC_RESET = 11 ; COMMAND
    Global Const $DHC_DEBUG_OPEN = 12 ; COMMAND
    Global Const $DHC_DEBUG_CLOSE = 13 ; COMMAND

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $DHC_WRITEMEMORY = 21 ; COMMAND
    Global Const $DHC_READMEMORY = 22 ; COMMAND
    Global Const $DHC_SIZEMEMORY = 23 ; COMMAND

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $DHC_3DWRITE = 25 ; COMMAND
    Global Const $DHC_3DREAD = 26 ; COMMAND
    Global Const $DHC_MMWRITE = 27 ; COMMAND
    Global Const $DHC_MMREAD = 28 ; COMMAND

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $DHC_TRANSPORT = 30 ; COMMAND
    Global Const $DHP_TRANSPORT_MODEALW = 1 ; PARAM
    Global Const $DHP_TRANSPORT_MODEALW32 = 2 ; PARAM
    Global Const $DHP_TRANSPORT_MODEOPT = 3 ; PARAM DEFAULT
    Global Const $DHP_TRANSPORT_MODEOPT32 = 4 ; PARAM

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $DHC_SERIALNREAD = 47 ; COMMAND
    Global Const $DHC_SERIALNWRITE = 48 ; COMMAND

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $DHE_OK = 1 ; RETURN NO ERROR
    Global Const $DHE_NOTHINGTODO = 2 ; RETURN NO ERROR

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $DHE_ERROR_COMMAND = -1 ; RETURN ERROR
    Global Const $DHE_ERROR_NOTOPEN = -2 ; RETURN ERROR
    Global Const $DHE_DMXOUT_PACKWRITE = -1000 ; RETURN ERROR -1005 = ERROR_ACCESS_DENIED -1023 = ERROR_CRC
    Global Const $DHE_DMXOUT_PACKREAD = -1100 ; RETURN ERROR

    [/autoit] [autoit][/autoit] [autoit]

    ; Dll öffnen
    Global Const $dhcDll = DllOpen ('DasHard.dll')

    [/autoit] [autoit][/autoit] [autoit]

    Opt ('OnExitFunc', 'Terminate')

    [/autoit] [autoit][/autoit] [autoit]

    ; Dll schließen
    Func Teminate ( )

    DllClose ('DasHard.dll')

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ; *** Dll Funktion ***
    Func HardDllCommand ($iCommand, $iParam, $pBloc)

    $aRes = DllCall ($dhcDll, 'int', 'HardDllCommand', _
    'int', $iCommand, _
    'int', $iParam, _
    'uchar*', $pBloc)
    Return $aRes[0]

    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; *** Open the interface when your application start :

    [/autoit] [autoit][/autoit] [autoit]

    Dim $v, $interface_open; // global
    $dmxblock = DllStructCreate ('uchar dmxblock[512]'); // global

    [/autoit] [autoit][/autoit] [autoit]

    $interface_open = HardDllCommand ($DHC_OPEN,0,0);
    if ($interface_open > 0) then
    for $i = 1 to 512
    DllStructSetData ($dmxblock, 'dmxblock', 0, $i);
    $v = HardDllCommand ($DHC_DMXOUTOFF,0,0);
    next
    endif
    ; Note :
    ; - When you open the interface, you don't know the state of the DMX output levels
    ; into the interface. It's why it's better to clean all DMX levels to be sure.

    [/autoit] [autoit][/autoit] [autoit]

    ; *** Send the DMX and read the PORT everytime :

    [/autoit] [autoit][/autoit] [autoit]

    Dim $v, $ports;
    if ($interface_open > 0) then
    $ports = HardDllCommand ($DHC_PORTREAD,0,0);
    $v = HardDllCommand ($DHC_DMXOUT, 512, DllStructGetPtr ($dmxblock, 'dmxblock')); evtl. 'dmxblock[0]' ...
    if ($v < 0) then
    $v = HardDllCommand ($DHC_CLOSE,0,0);
    $v = HardDllCommand ($DHC_OPEN,0,0);
    endif
    endif

    [/autoit] [autoit][/autoit] [autoit]

    ; Note :
    ; - When you use the DHC_DMXOUT command, the DLL analyses your DMX block.
    ; If there is no changes on the DMX levels, the function returns DHE_NOTHINGTODO and
    ; the DLL don't make a USB communication to save the CPU time of your computer.
    ; - After 6 seconds without USB communication, the USBDMX1 and interfaces go in stand alone mode
    ; (it's a nice feature, if the computer fails). It's why we propose to read the state of the
    ; port everytime to force a USB communication, with this, the interface do not go in stand alone mode.
    ; - If the DHC_DMXOUT command fails (for example, if the user unplug the USB interface !), you need
    ; to close and try to open again the interface.

    [/autoit] [autoit][/autoit] [autoit]

    ; *** Close the interface when your application finish :

    [/autoit] [autoit][/autoit] [autoit]

    Dim $v;
    if ($interface_open>0) then _
    $v = HardDllCommand ($DHC_CLOSE,0,0);

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    EDIT 2:
    Ich habe mit Dependency Walker nachgesehen, der Name der Funktion ist HardDllCommand.


    LG
    Greenhorn

  • Umgangsformen - wie gehen wir miteinander um

    • Greenhorn
    • 9. November 2008 um 18:43
    Zitat

    Mit dem Vollenden der Registrierung erklärst du dich damit einverstanden, diese Website nicht für Obszönitäten, Vulgäres, Beleidigungen, Propaganda (extremer) politischer Ansichten oder (verbaler) Verstöße gegen das Gesetz zu missbrauchen.

    Einige Punkte sollten vllt genauer definiert werden.


    LG
    Greenhorn

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™