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. BugFix

Beiträge von BugFix

  • Frage zur GUI

    • BugFix
    • 14. September 2017 um 23:42
    Zitat von autoiter

    Ich habe das mal mit Tastaturbefehlen probiert und finde es schwierig, das richtige Item zu identifizieren - egal ob DOWN oder PGDOWN gedrückt wurde. Bei Seitensprüngen muss man doch erst einmal ermitteln, wie viele Items gerade angezeigt werden, oder?

    Das ist völlig egal. Du fragst den iCode: $LVN_ITEMCHANGED ab und liest aus der Struktur $tagNMLISTVIEW das durch die aktuelle Aktion markierte Item (dessen Index) aus. Wie Kanashius bereits sagte: _GUICtrlListView_Create angucken, da findest du alle Infos.

  • XML-UDF nativ in AutoIt (+CSS-Selector-Feature)

    • BugFix
    • 13. September 2017 um 15:42
    Zitat von AspirinJunkie

    Hat das mal jemand anderes auch bestätigt oder tritt das nur bei dir auf?

    Ist ein generelles Win 7 - Problem. Hatten wir bezüglich eines anderen Skriptbeispiels ausgiebig getestet. Bei allen Win 7 Usern trat das Problem auf.

  • Anzeigefehler im Label

    • BugFix
    • 13. September 2017 um 14:10

    Man muss das & nicht zwingend maskieren. Gerade dann, wenn man ein Label für dynamische Texte verwendet wäre das ein zusätzlicher, nicht notwendiger Aufwand. Es gibt einen Style für diesen Fall: $SS_NOPREFIX

    AutoIt
    GUICreate('Test')
    GUICtrlCreateLabel('Copy & Paste', 20, 20, 150, 17, $SS_NOPREFIX)
    GUISetState()
    Do
    Until GUIGetMsg() = -3
  • [gelöst] Frage zur Rubrik 'Testforum'

    • BugFix
    • 13. September 2017 um 14:02
    Zitat von Musashi

    Da es in Off-Topic keinen Haken gibt

    Kannst ja im Startpost vor den Titel [gelöst] schreiben. Mach ich meist so.

  • Button Schrift linksbündig mit Abstand

    • BugFix
    • 10. September 2017 um 21:03

    Zuviel des Lobes, ich habe das Skript nur gefunden und auf aktuellen Funktionsstand gesetzt, sowie einige Optimierungen vorgenommen und die problembezogenen Änderungen eingebaut.

    Aber grundsätzlich macht das Basteln von eigenen Controls schon Spaß. Ich hatte mal ein eigenes Kontext-Menü-Ctrl erstellt. Als komplexe UDF ist das recht anspruchsvoll.

    Aber das Thema hier hat mich gereizt - ich legs mir mal in meine To-Do-List und werde eine kpl. Button-Ownerdraw-UDF erstellen. Dann kann ich auch gleich das Problem der fehlenden Colorierung bei Radio-Button mit beseitigen.

  • Button Schrift linksbündig mit Abstand

    • BugFix
    • 10. September 2017 um 15:55

    Ich habe jetzt nochmal an dem alten Skript geschraubt (hatte ich mal vor Jahren entdeckt, war ursprünglich zum Erstellen farbiger Button, als AutoIt dafür noch keine Funktionen hatte) und linken Rand und eine vertikale Zentrierung mit eingebaut.

    Der Aufwand selbst einen echten Button zu erzeugen ist nicht ohne - aber führt letztlich zum Erfolg. :thumbup:

    AutoIt
    #include <ButtonConstants.au3>
    #include <FrameConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <SendMessage.au3>
    #include <WinAPI.au3>
    #include <WinAPIConstants.au3>
    #include <WindowsConstants.au3>
    
    ; *******************************************************
    ; Example - Create an ownerdrawn button
    ; *******************************************************
    
    
    Opt('MustDeclareVars', 1)
    
    Global Const $ODS_SELECTED            = 0x0001
    Global Const $ODS_GRAYED            = 0x0002
    Global Const $ODS_DISABLED            = 0x0004
    Global Const $ODS_CHECKED            = 0x0008
    Global Const $ODS_FOCUS                = 0x0010
    Global Const $ODS_HOTLIGHT            = 0x0040
    Global Const $ODS_INACTIVE            = 0x0080
    Global Const $ODS_NOACCEL            = 0x0100
    Global Const $ODS_NOFOCUSRECT        = 0x0200
    
    Global Const $ODT_BUTTON            = 4
    
    Global $hGUI, $nButton, $nButton2
    
    ; seitlichen Abstand festlegen
    Global Const $iODT_BUTTONMARGIN = 10
    
    $hGUI = GUICreate("My Ownerdrawn Created Button", 300, 200)
    $nButton = GUICtrlCreateButton("Ownerdrawn Button multiline left aligned, three lines", 90, 50, 120, 60)
    GUICtrlSetStyle($nButton, BitOr($WS_TABSTOP, $BS_NOTIFY, $BS_OWNERDRAW)) ; Set the ownerdrawn flag
    
    $nButton2    = GUICtrlCreateButton("Normal Button", 90, 110, 120, 30)
    
    GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
    ; WM_DRAWITEM has to registered before showing GUI otherwise the initial drawing isn't done
    GUIRegisterMsg($WM_DRAWITEM, "MY_WM_DRAWITEM")
    
    GUISetState()
    
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
    
            Case $nButton
                Msgbox(0, "Info", "Ownerdrawn Button pressed")
    
            Case $nButton2
                Msgbox(0, "Info", "Button2 pressed")
        EndSwitch
    WEnd
    
    Exit
    
    
    ; React on a button click
    Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
        Local $nNotifyCode    = BitShift($wParam, 16)
        Local $nID            = BitAnd($wParam, 0x0000FFFF)
        Local $hCtrl        = $lParam
        Local $hFocus, $nCtrlID
    
        If $nID <> 2 And $nNotifyCode = 0 Then ; Check for IDCANCEL - 2
            ; Ownerdrawn buttons don't send something by pressing ENTER
            ; So IDOK - 1 comes up, now check for the control that has the current focus
            If $nID = 1 Then
                $hFocus = DllCall("user32.dll", "hwnd", "GetFocus")
                $nCtrlID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hFocus[0])
                _SendMessage($hWnd, $WM_COMMAND, $nCtrlID[0])
            Else
                _SendMessage($hWnd, $WM_COMMAND, $nID)
            EndIf
            Return 0
        EndIf
        Return $GUI_RUNDEFMSG
    EndFunc
    
    
    ; Draw the button
    Func MY_WM_DRAWITEM($hWnd, $Msg, $wParam, $lParam)
        Local $stDrawItem = DllStructCreate("uint;uint;uint;uint;uint;uint;uint;int[4];dword", $lParam)
    
        Local $nCtlType = DllStructGetData($stDrawItem, 1)
        If $nCtlType = $ODT_BUTTON Then
            Local $nCtrlID      = DllStructGetData($stDrawItem, 2)
            Local $nItemState = DllStructGetData($stDrawItem, 5)
            Local $hCtrl      = DllStructGetData($stDrawItem, 6)
            Local $hDC          = DllStructGetData($stDrawItem, 7)
            Local $nLeft      = DllStructGetData($stDrawItem, 8, 1)
            Local $nTop          = DllStructGetData($stDrawItem, 8, 2)
            Local $nRight      = DllStructGetData($stDrawItem, 8, 3)
            Local $nBottom      = DllStructGetData($stDrawItem, 8, 4)
            Local $sText      = ControlGetText($hWnd, '', $nCtrlID)
    ;~         Local $nTextColor = 0x5555DD
    ;~         Local $nBackColor = 0xFFEEDD
            DrawButton($hWnd, $hCtrl, $hDC, $nLeft, $nTop, $nRight, $nBottom, $nItemState, $sText);, $nTextColor, $nBackColor)
            $stDrawItem = 0
            Return 1
        EndIf
    
        $stDrawItem = 0
        Return $GUI_RUNDEFMSG
    EndFunc
    
    
    ; The main drawing procedure
    Func DrawButton($hWnd, $hCtrl, $hDC, $nLeft, $nTop, $nRight, $nBottom, $nItemState, $sText, $nTextColor=-1, $nBackColor=-1)
        ;Local $bDefault    = FALSE
        Local $bChecked    = BitAnd($nItemState, $ODS_CHECKED)
        Local $bFocused    = BitAnd($nItemState, $ODS_FOCUS)
        Local $bGrayed    = BitAnd($nItemState, BitOr($ODS_GRAYED, $ODS_DISABLED))
        Local $bSelected= BitAnd($nItemState, $ODS_SELECTED)
    
        Local $stRect = DllStructCreate("int;int;int;int")
        DllStructSetData($stRect, 1, $nLeft)
        DllStructSetData($stRect, 2, $nTop)
        DllStructSetData($stRect, 3, $nRight)
        DllStructSetData($stRect, 4, $nBottom)
    
        Local $nClrTxt, $hBrush, $nClrSel, $nClrBk, $hOldBrush
        If $bGrayed Then
            $nClrTxt    = _WinAPI_SetTextColor($hDC, _WinAPI_GetSysColor($COLOR_HIGHLIGHTTEXT))
        ElseIf $nTextColor = -1 Then
            $nClrTxt    = _WinAPI_SetTextColor($hDC, _WinAPI_GetSysColor($COLOR_BTNTEXT))
        Else
            $nClrTxt    = _WinAPI_SetTextColor($hDC, $nTextColor)
        EndIf
    
        If $nBackColor = -1 Then
            $hBrush        = _WinAPI_GetSysColorBrush($COLOR_BTNFACE)
            $nClrSel    = _WinAPI_GetSysColor($COLOR_BTNFACE)
        Else
            $hBrush        = _WinAPI_CreateSolidBrush($nBackColor)
            $nClrSel    = $nBackColor;
        EndIf
    
        $nClrBk            = _WinAPI_SetBkColor($hDC, $nClrSel)
        $hOldBrush        = _WinAPI_SelectObject($hDC, $hBrush)
    
        Local $nTmpLeft       = $nLeft
        Local $nTmpTop       = $nTop
        Local $nTmpRight   = $nRight
        Local $nTmpBottom  = $nBottom
        Local $hBrushSel
    
        If $bSelected Then
            InflateRect($nTmpLeft, $nTmpTop, $nTmpRight, $nTmpBottom, -1, -1)
            $hBrushSel = _WinAPI_CreateSolidBrush(_WinAPI_GetSysColor($COLOR_BTNSHADOW))
            FrameRect($hDC, $nTmpLeft, $nTmpTop, $nTmpRight, $nTmpBottom, $hBrushSel)
            _WinAPI_DeleteObject($hBrushSel)
        Else
            If $bFocused And Not $bSelected Then InflateRect($nTmpLeft, $nTmpTop, $nTmpRight, $nTmpBottom, -1, -1)
            DrawFrameControl($hDC, $nTmpLeft, $nTmpTop, $nTmpRight, $nTmpBottom, $DFC_BUTTON, $DFCS_BUTTONPUSH)
        EndIf
    
        $nTmpLeft    = $nLeft
        $nTmpTop    = $nTop
        $nTmpRight    = $nRight
        $nTmpBottom    = $nBottom
    
        If $bSelected Then
            InflateRect($nTmpLeft, $nTmpTop, $nTmpRight, $nTmpBottom, -2, -2)
        Else
            If $bFocused And Not $bSelected Then
                InflateRect($nTmpLeft, $nTmpTop, $nTmpRight, $nTmpBottom, -3, -3)
                $nTmpLeft -= 1
                $nTmpTop -= 1
            Else
                InflateRect($nTmpLeft, $nTmpTop, $nTmpRight, $nTmpBottom, -2, -2)
                $nTmpLeft -= 1
                $nTmpTop -= 1
            EndIf
        EndIf
    
        FillRect($hDC, $nTmpLeft, $nTmpTop, $nTmpRight, $nTmpBottom, $hBrush)
    
        If $bSelected Or $bGrayed Then
            $nTmpLeft = $nTmpLeft + 2
            $nTmpTop = $nTmpTop +2
        EndIf
    
    ;~     Local $uFlags = BitOr($DT_NOCLIP, $DT_CENTER, $DT_VCENTER)
        Local $uFlags = BitOr($DT_NOCLIP, $DT_LEFT, $DT_WORDBREAK)
    
    ;~     If Not BitAnd(_WinAPI_GetWindowLong($hCtrl, $GWL_STYLE), $BS_MULTILINE) Then $uFlags = BitOr($uFlags, $DT_SINGLELINE)
    
        ; tatsächlich verwendete Schrifthöhe ermitteln
        Local $iUsedHeigth = DrawTextCalc($hDC, $sText, $nTmpLeft, $nTmpTop, $nTmpRight, $nTmpBottom, $uFlags)
    
        ; Button-Text mit Abstand links und vertikal zentriert zeichnen
    ;~     DrawText($hDC, $sText, $nTmpLeft, $nTmpTop, $nTmpRight, $nTmpBottom, $uFlags)
        DrawText($hDC, $sText, $nTmpLeft+$iODT_BUTTONMARGIN, $nTmpTop+Ceiling(($nTmpBottom-$nTmpTop-$iUsedHeigth)/2), $nTmpRight-$iODT_BUTTONMARGIN, $nTmpBottom, $uFlags)
    
        If $bGrayed Then
            $nTmpLeft    = $nLeft
            $nTmpTop    = $nTop
            $nTmpRight    = $nRight
            $nTmpBottom    = $nBottom
    
            $nTmpLeft -= 1
    
            $nClrTxt    = _WinAPI_SetTextColor($hDC, _WinAPI_GetSysColor($COLOR_GRAYTEXT))
    ;~         DrawText($hDC, $sText, $nTmpLeft, $nTmpTop, $nTmpRight, $nTmpBottom, BitOr($DT_NOCLIP, $DT_CENTER, $DT_VCENTER, $DT_SINGLELINE))
            DrawText($hDC, $sText, $nTmpLeft+$iODT_BUTTONMARGIN, $nTmpTop+Ceiling(($nTmpBottom-$nTmpTop-$iUsedHeigth)/2), $nTmpRight-$iODT_BUTTONMARGIN, $nTmpBottom, BitOr($DT_NOCLIP, $DT_LEFT, $DT_WORDBREAK))
        EndIf
    
        $nTmpLeft    = $nLeft
        $nTmpTop    = $nTop
        $nTmpRight    = $nRight
        $nTmpBottom    = $nBottom
    
        If $bFocused Then
            $hBrush    = _WinAPI_CreateSolidBrush(0)
            FrameRect($hDC, $nTmpLeft, $nTmpTop, $nTmpRight, $nTmpBottom, $hBrush)
    
            $nTmpLeft    = $nLeft
            $nTmpTop    = $nTop
            $nTmpRight    = $nRight
            $nTmpBottom    = $nBottom
    
            InflateRect($nTmpLeft, $nTmpTop, $nTmpRight, $nTmpBottom, -4, -4)
            DrawFocusRect($hDC, $nTmpLeft, $nTmpTop, $nTmpRight, $nTmpBottom)
        EndIf
    
        _WinAPI_SelectObject($hDC, $hOldBrush)
        _WinAPI_DeleteObject($hBrush)
        _WinAPI_SetTextColor($hDC, $nClrTxt)
        _WinAPI_SetBkColor($hDC, $nClrBk)
    
        Return 1
    EndFunc
    
    
    Func DrawFrameControl($hDC, $nLeft, $nTop, $nRight, $nBottom, $nType, $nState)
        Local     $stRect = DllStructCreate("int;int;int;int")
        _SetRect($stRect, $nLeft, $nTop, $nRight, $nBottom)
        DllCall("user32.dll", "int", "DrawFrameControl", "hwnd", $hDC, "ptr", DllStructGetPtr($stRect), "int", $nType, "int", $nState)
        $stRect = 0
    EndFunc
    
    
    Func DrawFocusRect($hDC, $nLeft, $nTop, $nRight, $nBottom)
        Local     $stRect = DllStructCreate("int;int;int;int")
        _SetRect($stRect, $nLeft, $nTop, $nRight, $nBottom)
        DllCall("user32.dll", "int", "DrawFocusRect", "hwnd", $hDC, "ptr", DllStructGetPtr($stRect))
        $stRect = 0
    EndFunc
    
    
    Func DrawTextCalc($hDC, $sText, $nLeft, $nTop, $nRight, $nBottom, $nFormat)
        Local $nLen = StringLen($sText)
        Local $stRect = DllStructCreate("int;int;int;int")
        _SetRect($stRect, $nLeft, $nTop, $nRight, $nBottom)
        Local $stText = DllStructCreate("char[260]")
        DllStructSetData($stText, 1, $sText)
        Local $aRet = DllCall("user32.dll", "int", "DrawText", "hwnd", $hDC, "ptr", DllStructGetPtr($stText), "int", $nLen, "ptr", DllStructGetPtr($stRect), "int", BitOR($nFormat,$DT_CALCRECT))
        $stRect = 0
        $stText    = 0
        Return $aRet[0]
    EndFunc
    
    
    Func DrawText($hDC, $sText, $nLeft, $nTop, $nRight, $nBottom, $nFormat)
        Local $nLen = StringLen($sText)
        Local $stRect = DllStructCreate("int;int;int;int")
        _SetRect($stRect, $nLeft, $nTop, $nRight, $nBottom)
        Local $stText = DllStructCreate("char[260]")
        DllStructSetData($stText, 1, $sText)
        DllCall("user32.dll", "int", "DrawText", "hwnd", $hDC, "ptr", DllStructGetPtr($stText), "int", $nLen, "ptr", DllStructGetPtr($stRect), "int", $nFormat)
        $stRect = 0
        $stText    = 0
    EndFunc
    
    
    Func FillRect($hDC, $nLeft, $nTop, $nRight, $nBottom, $hBrush)
        Local     $stRect = DllStructCreate("int;int;int;int")
        _SetRect($stRect, $nLeft, $nTop, $nRight, $nBottom)
        DllCall("user32.dll", "int", "FillRect", "hwnd", $hDC, "ptr", DllStructGetPtr($stRect), "hwnd", $hBrush)
        $stRect = 0
    EndFunc
    
    
    Func FrameRect($hDC, $nLeft, $nTop, $nRight, $nBottom, $hBrush)
        Local     $stRect = DllStructCreate("int;int;int;int")
        _SetRect($stRect, $nLeft, $nTop, $nRight, $nBottom)
        DllCall("user32.dll", "int", "FrameRect", "hwnd", $hDC, "ptr", DllStructGetPtr($stRect), "hwnd", $hBrush)
        $stRect = 0
    EndFunc
    
    
    Func InflateRect(ByRef $nLeft, ByRef $nTop, ByRef $nRight, ByRef $nBottom, $nX, $nY)
        Local     $stRect = DllStructCreate("int;int;int;int")
        _SetRect($stRect, $nLeft, $nTop, $nRight, $nBottom)
        DllCall("user32.dll", "int", "InflateRect", "ptr", DllStructGetPtr($stRect), "int", $nX, "int", $nY)
        _GetRect($stRect, $nLeft, $nTop, $nRight, $nBottom)
        $stRect = 0
    EndFunc
    
    Func _SetRect(ByRef $t, $iL, $iT, $iR, $iB)
        DllStructSetData($t, 1, $iL)
        DllStructSetData($t, 2, $iT)
        DllStructSetData($t, 3, $iR)
        DllStructSetData($t, 4, $iB)
    EndFunc
    
    Func _GetRect(ByRef $t, ByRef $nLeft, ByRef $nTop, ByRef $nRight, ByRef $nBottom)
        $nLeft     = DllStructGetData($t, 1)
        $nTop     = DllStructGetData($t, 2)
        $nRight     = DllStructGetData($t, 3)
        $nBottom = DllStructGetData($t, 4)
    EndFunc
    Alles anzeigen

    EDIT:

    Ich habe gerade festgestellt, dass sich etwas an Aufwand sparen lässt, wen man statt DrawText die Funktion DrawTextEx verwendet. Diese enthält eine optionale Struktur zum Setzen von Rand links und/oder rechts und Tabweite. Werde ich in der UDF berücksichtigen.

  • Button Schrift linksbündig mit Abstand

    • BugFix
    • 10. September 2017 um 10:48

    Ich habe jetzt mal ein altes Skript zum selbst Zeichnen von Button vorgekramt. Grundsätzliche liesse sich der Abstand links einbauen - aber: auch Button haben im Multiline keine vertikale Zentrierung

    Zitat von DrawText function
    DT_VCENTER

    Centers text vertically. This value is used only with the DT_SINGLELINE value.

    Du musst also mit einigen Einschränkungen leben.

  • [offen] - USB Autoswitch

    • BugFix
    • 9. September 2017 um 23:58

    Ich habe mal die FAQ zu den Silex durchgelesen, demnach baut der Server eine exklusive Verbindung zu einem USB Gerät auf. Ein wechselseitiger automatischer Zugriff sei nicht möglich, eine softwarebasierte Umschaltung muss vom User ausgeführt werden.

    Widerspricht eigentlich der Artikelbeschreibung.

    Micha_he:

    Welches Modell verwendet ihr? Ich hatte mir den Silex DS-510 angesehen.


  • [offen] - USB Autoswitch

    • BugFix
    • 9. September 2017 um 12:33

    Hat jemand von euch schon mal einen USB-Autoswitch verwendet?

    Folgende Konstellation:

    - Multifunktionsgerät (MFC-7360N)

    - zwei getrennte Netzwerke (ein Intranet und eines mit Internetzugriff)

    - per Netzwerkadapter ist das MFC im Intranet eingebunden

    - per USB ist die Verbindung zu einem Internet-PC

    Was möchte ich:

    Mehrere PC im Internet-Netzwerk sollen Zugriff auf das MFC haben. bisher habe ich zumindest den Drucker nutzen können über eine Freigabe auf dem direkt angeschlossenen PC. Das ermöglicht aber keinen Zugriff auf die Scanfunktion - und die ist zwingend erforderlich.

    Nun hatte ich gesucht, ob es automatische Umschalter für USB-Geräte gibt, denn eine Umschaltung von Hand ist indiskutabel. Ich bin auch fündig geworden und habe diesen Switch entdeckt:

    USB 2.0 Auto Switch PRO, 4 Rechner / 1 Device.

    Hat jemand schon mal mit einem derartigen Switch gearbeitet und kann bestätigen, dass dieser, wie von mir gewünscht, verwendet werden kann?

  • Button Schrift linksbündig mit Abstand

    • BugFix
    • 9. September 2017 um 12:14

    Du kannst dir einen Button selbst aus Label konstruieren. Einzig der visuelle Klick ist nicht vorhanden.

    Da Label nicht vertikal zentriert werden können, musst du einen oberen Rand angeben um das zu erreichen:

    AutoIt: _GUICtrlCreateButton_LeftAligned()
    $hGui = GUICreate('Test - Button')
    
    $iBtnX = 50
    $iBtnY = 50
    $iBtnWidth = 140
    $iBtnHeigth = 60
    
    $iMarginLeft = 10
    $iMarginTop = 10
    
    $idButton = _GUICtrlCreateButton_LeftAligned('Das ist ein mehrzeiliger Button, links ausgerichtet mit Rand', $iMarginLeft, $iMarginTop, $iBtnX, $iBtnY, $iBtnWidth, $iBtnHeigth)
    
    GUISetState(@SW_SHOW)
    
    While True
        Switch GUIGetMsg()
            Case -3
                Exit
            Case $idButton
                ConsoleWrite('Button Click' & @CRLF)
        EndSwitch
    WEnd
    
    
    ;=============================================================================
    ; Function Name:   _GUICtrlCreateButton_LeftAligned()
    ; Description:     Creates a Button with a leftside margin. Text ist left aligned, multiline.
    ; Syntax:          _GUICtrlCreateButton_LeftAligned($sText, $iMarginLeft, $iMarginTop, $iLeft, $iTop, $iWidth, $iHeight)
    ; Parameter(s):    $sText       Button text
    ;                  $iMarginLeft Left margin from text
    ;                  $iMarginTop  Top margin from text
    ;                  $iLeft       The left side of the control
    ;                  $iTop        The top of the control
    ;                  $iWidth      The width of the control
    ;                  $iHeight     The height of the control
    ; Return Value(s): ID Button
    ; Note:            Because label have none style to center vertically, you must set a top margin.
    ; Author:          BugFix
    ;=============================================================================
    Func _GUICtrlCreateButton_LeftAligned($sText, $iMarginLeft, $iMarginTop, $iLeft, $iTop, $iWidth, $iHeight)
        Local $idRet
        $idRet = GUICtrlCreateLabel("", $iLeft, $iTop, $iWidth, $iHeight, $SS_BLACKRECT)
        GUICtrlCreateLabel("", $iLeft, $iTop, $iWidth -1, $iHeight -1, $SS_WHITERECT)
        GUICtrlCreateLabel("", $iLeft +1, $iTop +1, $iWidth -2, $iHeight -2)
        GUICtrlCreateLabel($sText, $iLeft +$iMarginLeft +1, $iTop +$iMarginTop +1, $iWidth -$iMarginLeft -3, $iHeight -$iMarginTop -3, $SS_NOTIFY)
        Return $idRet
    EndFunc ;==>_GUICtrlCreateColorButton
    Alles anzeigen
  • Keine Verbindung PC Win7 auf Windows 2000 Server

    • BugFix
    • 7. September 2017 um 20:32
    Zitat

    Lt. RFC 4430 - Kerberized Internet Negotiation of Keys darf der Zeitunterschied nicht länger als fünf Minuten betragen.

    Das mag sein, stimmt aber nicht generell, sondern nur für die die erste Anmeldung. Danach kannst du auch mit 1 Stunde Unterschied ohne Probleme einloggen (meine Erfahrung).

    Aber wenn die Kiste einen Zeitunterschied feststellt - weshalb wird das nicht in der Fehlermeldung benannt, sondern von falschem Usernamen oder Passwort gefaselt?

  • Keine Verbindung PC Win7 auf Windows 2000 Server

    • BugFix
    • 6. September 2017 um 18:55

    Heute habe ich eine Stunde mit diesem Problem gekämpft:

    - Arbeitsgruppennetzwerk

    - Server: Windows 2000 Server

    - Benutzer mit Passwort identisch auf Server und PC angelegt

    - Verbindungsversuch vom PC schlägt immer fehl wegen: "Benutzername oder Kennwort falsch"

    Beim Googlen zeigte sich, dass das Problem häufig auftritt. Die empfohlenen Lösungswege (Änderung Sicherheitsrichtlinien, Registryänderungen, etc. pp.) waren alle ohne Erfolg.

    In einem engl. Forum wurde ich dann doch fündig. Und die Lösung könnte man glatt für einen Witz halten, wenn man nicht selbst die Wirksamkeit erlebt hat:

    Die Uhrzeit von PC und Server MUSS MINUTENSYNCHRON sein. :rofl::Face:

    Interessant ist natürlich die Logik, dass asynchrone Uhrzeit als falscher Benutzer oder Passwort interpretiert wird - that's M$.

  • Forenupdate - September 2017 - Probleme / Anregungen / Feedback - Sammelthread

    • BugFix
    • 5. September 2017 um 23:44

    Ich hatte es schon mal angesprochen, bisher ohne Reaktion:

    Ich finde, die "Letzten Aktivitäten" machen das Forum fast unlesbar. Entweder komplett rauswerfen oder optional in den Einstellungen von jedem selbst on/off zu setzen.

  • [gelöst] SQLite - Ergebniswerte entsprechen nicht den Spalten, keine Sortierung

    • BugFix
    • 2. September 2017 um 23:00
    Zitat von AspirinJunkie

    Dann kannst du die Spaltenreihenfolge neu festlegen und hast immer noch das selbe ListView.

    Ich habe diese Variante mal durchgespielt.

    Dann erfolgt die Spaltenumbenennung erst beim Befüllen mit Daten (finde ich dann nicht gelungen, die Feldnamen sind auch noch in die gewünschte Spaltenbezeichnung umzuwandeln), die Spaltenbreite muss auch noch angepasst werden. Insofern bevorzuge ich doch die Variante mit vordefinierten Listview.

  • [gelöst] SQLite - Ergebniswerte entsprechen nicht den Spalten, keine Sortierung

    • BugFix
    • 2. September 2017 um 20:46

    Nachtrag:

    Ich habe jetzt im Vorfeld für jede Abfragevariante ein eigenes Listview erstellt, das entsprechend eingeblendet wird. Nun läuft alles geschmeidig. :D

    So schaut's jetzt aus:

    AutoIt: PLZ_Auswahl.au3
    ;-- TIME_STAMP   2017-09-02 20:39:02
    
    #include <SQLite.au3>
    #include <WindowsConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <EditConstants.au3>
    #include <GuiListView.au3>
    
    Opt('GUIOnEventMode', 1)
    
    _SQLite_Startup()
    
    Global $DB = @ScriptDir & '\plz_brd.db'
    Global $hSQL = _SQLite_Open($DB)
    Global $sUserSearchField = 'plz', $sUserValue
    
    Global $hGui = GUICreate('PLZ der BRD', 480, 300)
    GUISetOnEvent(-3, '_Exit')
    
    GUIStartGroup()
    Global $rPLZ = GUICtrlCreateRadio('  PLZ', 10, 15, 80)
    GUICtrlSetState(-1, $GUI_CHECKED)
    Global $rORT = GUICtrlCreateRadio('  Ort', 133, 15, 80)
    Global $rBULA = GUICtrlCreateRadio('  Bundesland', 256, 15, 80)
    Global $rKREIS = GUICtrlCreateRadio('  Landreis', 379, 15, 80)
    
    GUIStartGroup()
    Global $lbOrder = GUICtrlCreateLabel('Sortierung nach:', 155, 43)
    GUICtrlSetState(-1, $GUI_DISABLE)
    Global $rOrderPlz = GUICtrlCreateRadio('  PLZ', 256, 40, 80)
    GUICtrlSetState(-1, $GUI_CHECKED)
    GUICtrlSetState(-1, $GUI_DISABLE)
    Global $rOrderOrt = GUICtrlCreateRadio('  Ort', 379, 40, 80)
    GUICtrlSetState(-1, $GUI_DISABLE)
    
    GUICtrlSetOnEvent($rPLZ, '_RadioClick')
    GUICtrlSetOnEvent($rORT, '_RadioClick')
    GUICtrlSetOnEvent($rBULA, '_RadioClick')
    GUICtrlSetOnEvent($rKREIS, '_RadioClick')
    GUICtrlSetOnEvent($rOrderPlz, '_RadioClick')
    GUICtrlSetOnEvent($rOrderOrt, '_RadioClick')
    
    GUICtrlCreateLabel('Suchbegriff', 32, 73)
    Global $inSearchWord = GUICtrlCreateInput('', 133, 70, 330)
    
    Global $hListview_plz = GuiCtrlCreateListView('PLZ|Ort|Bundesland|Landkreis', 10, 100, 460, 190, -1, BitOR($LVS_EX_DOUBLEBUFFER,$LVS_EX_GRIDLINES))
    _GUICtrlListView_SetColumnWidth($hListview_plz, 0, 60)
    _GUICtrlListView_SetColumnWidth($hListview_plz, 1, 135)
    _GUICtrlListView_SetColumnWidth($hListview_plz, 2, 135)
    _GUICtrlListView_SetColumnWidth($hListview_plz, 3, $LVSCW_AUTOSIZE_USEHEADER)
    
    Global $hListview_ort = GuiCtrlCreateListView('Ort|PLZ|Bundesland|Landkreis', 10, 100, 460, 190, -1, BitOR($LVS_EX_DOUBLEBUFFER,$LVS_EX_GRIDLINES))
    GUICtrlSetState(-1, $GUI_HIDE)
    _GUICtrlListView_SetColumnWidth($hListview_ort, 0, 135)
    _GUICtrlListView_SetColumnWidth($hListview_ort, 1, 60)
    _GUICtrlListView_SetColumnWidth($hListview_ort, 2, 135)
    _GUICtrlListView_SetColumnWidth($hListview_ort, 3, $LVSCW_AUTOSIZE_USEHEADER)
    
    Global $hListview_bula_plz_ort = GuiCtrlCreateListView('Bundesland|PLZ|Ort|Landkreis', 10, 100, 460, 190, -1, BitOR($LVS_EX_DOUBLEBUFFER,$LVS_EX_GRIDLINES))
    GUICtrlSetState(-1, $GUI_HIDE)
    _GUICtrlListView_SetColumnWidth($hListview_bula_plz_ort, 0, 135)
    _GUICtrlListView_SetColumnWidth($hListview_bula_plz_ort, 1, 60)
    _GUICtrlListView_SetColumnWidth($hListview_bula_plz_ort, 2, 135)
    _GUICtrlListView_SetColumnWidth($hListview_bula_plz_ort, 3, $LVSCW_AUTOSIZE_USEHEADER)
    
    Global $hListview_bula_ort_plz = GuiCtrlCreateListView('Bundesland|Ort|PLZ|Landkreis', 10, 100, 460, 190, -1, BitOR($LVS_EX_DOUBLEBUFFER,$LVS_EX_GRIDLINES))
    GUICtrlSetState(-1, $GUI_HIDE)
    _GUICtrlListView_SetColumnWidth($hListview_bula_ort_plz, 0, 135)
    _GUICtrlListView_SetColumnWidth($hListview_bula_ort_plz, 1, 135)
    _GUICtrlListView_SetColumnWidth($hListview_bula_ort_plz, 2, 60)
    _GUICtrlListView_SetColumnWidth($hListview_bula_ort_plz, 3, $LVSCW_AUTOSIZE_USEHEADER)
    
    Global $hListview_kreis_plz_ort = GuiCtrlCreateListView('Landkreis|PLZ|Ort|Bundesland', 10, 100, 460, 190, -1, BitOR($LVS_EX_DOUBLEBUFFER,$LVS_EX_GRIDLINES))
    GUICtrlSetState(-1, $GUI_HIDE)
    _GUICtrlListView_SetColumnWidth($hListview_kreis_plz_ort, 0, 135)
    _GUICtrlListView_SetColumnWidth($hListview_kreis_plz_ort, 1, 60)
    _GUICtrlListView_SetColumnWidth($hListview_kreis_plz_ort, 2, 135)
    _GUICtrlListView_SetColumnWidth($hListview_kreis_plz_ort, 3, $LVSCW_AUTOSIZE_USEHEADER)
    
    Global $hListview_kreis_ort_plz = GuiCtrlCreateListView('Landkreis|Ort|PLZ|Bundesland', 10, 100, 460, 190, -1, BitOR($LVS_EX_DOUBLEBUFFER,$LVS_EX_GRIDLINES))
    GUICtrlSetState(-1, $GUI_HIDE)
    _GUICtrlListView_SetColumnWidth($hListview_kreis_ort_plz, 0, 135)
    _GUICtrlListView_SetColumnWidth($hListview_kreis_ort_plz, 1, 135)
    _GUICtrlListView_SetColumnWidth($hListview_kreis_ort_plz, 2, 60)
    _GUICtrlListView_SetColumnWidth($hListview_kreis_ort_plz, 3, $LVSCW_AUTOSIZE_USEHEADER)
    
    
    GUISetState()
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
    
    While True
        Sleep(50)
    WEnd
    
    Func _Exit()
        _ExitSQLite()
        Exit
    EndFunc
    
    Func _RadioClick()
        Local $hLV = _CurrentListview()
        _ClearListview($hLV)
        GUICtrlSetData($inSearchWord, '')
        _ShowHideLV($hLV)
        Switch @GUI_CtrlId
            Case $rPLZ
                _EnDisAbleSortOrder($GUI_DISABLE)
                $sUserSearchField = 'plz'
            Case $rORT
                _EnDisAbleSortOrder($GUI_DISABLE)
                $sUserSearchField = 'ort'
            Case $rKREIS, $rBULA
                _EnDisAbleSortOrder($GUI_ENABLE)
                $sUserSearchField = @GUI_CtrlId = $rKREIS ? 'kreis' : 'bula'
                $sUserSearchField &= (BitAND(GUICtrlRead($rOrderPlz),$GUI_CHECKED) ? '-plz-ort' : '-ort-plz')
            Case $rOrderPlz, $rOrderOrt
                $sUserSearchField = BitAND(GUICtrlRead($rKREIS),$GUI_CHECKED) ? 'kreis' : 'bula'
                $sUserSearchField &= (BitAND(GUICtrlRead($rOrderPlz),$GUI_CHECKED) ? '-plz-ort' : '-ort-plz')
        EndSwitch
    EndFunc
    
    Func _EnDisAbleSortOrder($iState)
        GUICtrlSetState($lbOrder,$iState)
        GUICtrlSetState($rOrderOrt,$iState)
        GUICtrlSetState($rOrderPlz,$iState)
    EndFunc
    
    Func _ShowHideLV($hLV_show)
        Local Static $aLV[] = [$hListview_plz,$hListview_ort,$hListview_bula_plz_ort,$hListview_bula_ort_plz,$hListview_kreis_plz_ort,$hListview_kreis_ort_plz]
        For $i = 0 To 5
            GUICtrlSetState($aLV[$i], $GUI_HIDE)
        Next
        GUICtrlSetState($hLV_show, $GUI_SHOW)
    EndFunc
    
    Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
        Local $iIDFrom, $iCode, $hWndEdit, $sRead, $index
        $hWndEdit = GUICtrlGetHandle($inSearchWord)
        $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
        $iCode = BitShift($iwParam, 16) ; Hi Word
        Switch $ilParam
            Case $hWndEdit
                Switch $iCode
                    Case $EN_CHANGE
                        _ClearListview(_CurrentListview())
                        $sUserValue = GUICtrlRead($iIDFrom)
                        If ($sUserValue = '')  Or _
                           ($sUserSearchField = 'ort' And StringLen($sUserValue) < 3) Then Return $GUI_RUNDEFMSG
                        _PLZSearch_CreateLVItem($sUserValue, $sUserSearchField)
                EndSwitch
        EndSwitch
        Return $GUI_RUNDEFMSG
    EndFunc   ;==>WM_COMMAND
    
    Func _ClearListview($hLV)
        _GUICtrlListView_DeleteAllItems($hLV)
    EndFunc
    
    Func _CurrentListview()
        Select
            Case BitAND(GUICtrlRead($rPLZ), $GUI_CHECKED)
                Return $hListview_plz
            Case BitAND(GUICtrlRead($rORT), $GUI_CHECKED)
                Return $hListview_ort
            Case BitAND(GUICtrlRead($rBULA), $GUI_CHECKED)
                If BitAND(GUICtrlRead($rOrderPlz), $GUI_CHECKED) Then
                    Return $hListview_bula_plz_ort
                Else
                    Return $hListview_bula_ort_plz
                EndIf
            Case BitAND(GUICtrlRead($rKREIS), $GUI_CHECKED)
                If BitAND(GUICtrlRead($rOrderPlz), $GUI_CHECKED) Then
                    Return $hListview_kreis_plz_ort
                Else
                    Return $hListview_kreis_ort_plz
                EndIf
        EndSelect
    EndFunc
    
    Func _PLZSearch_CreateLVItem($sSearch, $sFieldOrder)
        Local $sQuery = ''
        Switch $sFieldOrder
            Case 'plz'
                $sQuery = "SELECT plz,ort,bula,kreis FROM plz WHERE plz LIKE " & _SQLite_Escape($sSearch & '%') & " ORDER BY plz,ort,bula,kreis;"
            Case 'ort'
                $sQuery = "SELECT ort,plz,bula,kreis FROM plz WHERE ort LIKE " & _SQLite_Escape($sSearch & '%') & " ORDER BY ort,plz,bula,kreis;"
            Case 'bula-plz-ort'
                $sQuery = "SELECT bula,plz,ort,kreis FROM plz WHERE bula LIKE " & _SQLite_Escape($sSearch & '%') & " ORDER BY bula,plz,ort,kreis;"
            Case 'bula-ort-plz'
                $sQuery = "SELECT bula,ort,plz,kreis FROM plz WHERE bula LIKE " & _SQLite_Escape($sSearch & '%') & " ORDER BY bula,ort,plz,kreis;"
            Case 'kreis-plz-ort'
                $sQuery = "SELECT kreis,plz,ort,bula FROM plz WHERE kreis LIKE " & _SQLite_Escape($sSearch & '%') & " ORDER BY kreis,plz,ort,bula;"
            Case 'kreis-ort-plz'
                $sQuery = "SELECT kreis,ort,plz,bula FROM plz WHERE kreis LIKE " & _SQLite_Escape($sSearch & '%') & " ORDER BY kreis,ort,plz,bula;"
        EndSwitch
    
        _GUICtrlListView_BeginUpdate(_CurrentListview())
        Local $hQuery, $aRow, $aColumns
        _SQLite_Query($hSQL, $sQuery, $hQuery)
    
        While _SQLite_FetchData($hQuery, $aRow, False, False) = $SQLITE_OK
            GUICtrlCreateListViewItem(StringFormat('%s|%s|%s|%s', $aRow[0], $aRow[1], $aRow[2], $aRow[3]), _CurrentListview())
        WEnd
    
        _SQLite_QueryFinalize($hQuery)
        _GUICtrlListView_EndUpdate(_CurrentListview())
    EndFunc
    
    
    Func _ExitSQLite()
        _SQLite_Close()
        _SQLite_Shutdown()
    EndFunc
    Alles anzeigen
  • [gelöst] SQLite - Ergebniswerte entsprechen nicht den Spalten, keine Sortierung

    • BugFix
    • 2. September 2017 um 19:27

    Ah, OK - Danke euch. Dann muss ich das etwas umbauen.

    Ich hatte auch zuerst mit _SQLite_GetTable2d gearbeitet. Aber die Zeit, die ich dabei spare, verliere ich anschliessend, weil ich durch das Array iterieren muss um die ListviewItem zu erstellen. Beim Fetchen mache ich das sofort.

    _SQLite_Escape zu verwenden ist ein guter Hinweis. Denke ich meist nicht dran, weil ich SQLite fast nur für mich nutze.

  • [gelöst] SQLite - Ergebniswerte entsprechen nicht den Spalten, keine Sortierung

    • BugFix
    • 2. September 2017 um 17:30

    Ich habe eine kleine GUI zum Filtern von PLZ nach PLZ oder Ort oder Bundesland oder Landkreis erstellt.

    Bei PLZ und ORT ist die Sortierung: PLZ/Ort-Ort/PLZ-Bundesland-Landkreis.

    Über die Radio-Ctrl wird die Filterung und bei Bundesland und Landkreis zusätzlich die Sortierung gewählt. Anhand dieser Auswahl wird in Verbindung mit der Usereingabe eine SQL-Abfrage durchgeführt und das Ergebnis in das Listview geladen.

    Bei der PLZ-Filterung passt auch alles. Wähle ich aber eine andere Variante, ist zwar die Spalten-Namen-Reihenfolge des Ergebnisarrays identisch mit der Abfrage, aber der Zeileninhalt ist falsch zugeordnet und auch die Sortierung findet nicht statt.

    Ich habe mich jetzt 1 Tag damit rumgequält ohne einen Fehler zu finden. Habt ihr eine Ahnung?

    Btw.: Führe ich die SQL-Statements im SQLiteDatabaseBrowser aus, erhalte ich die Ergebnisse, wie gewünscht.

    Die Datenbank SQLite3.dll und das Skript im Anhang.

    AutoIt: PLZ_Auswahl.au3
    ;-- TIME_STAMP   2017-09-02 16:24:24
    
    #include <SQLite.au3>
    #include <WindowsConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <EditConstants.au3>
    #include <GuiListView.au3>
    
    Opt('GUIOnEventMode', 1)
    
    _SQLite_Startup()
    
    Global $DB = @ScriptDir & '\plz_brd.db'
    Global $hSQL = _SQLite_Open($DB)
    Global $sUserSearchField = 'plz', $sUserValue
    
    Global $hGui = GUICreate('PLZ der BRD', 480, 300)
    GUISetOnEvent(-3, '_Exit')
    
    GUIStartGroup()
    Global $rPLZ = GUICtrlCreateRadio('  PLZ', 10, 15, 80)
    GUICtrlSetState(-1, $GUI_CHECKED)
    Global $rORT = GUICtrlCreateRadio('  Ort', 133, 15, 80)
    Global $rBULA = GUICtrlCreateRadio('  Bundesland', 256, 15, 80)
    Global $rKREIS = GUICtrlCreateRadio('  Landreis', 379, 15, 80)
    
    GUIStartGroup()
    Global $lbOrder = GUICtrlCreateLabel('Sortierung nach:', 155, 43)
    GUICtrlSetState(-1, $GUI_DISABLE)
    Global $rOrderPlz = GUICtrlCreateRadio('  PLZ', 256, 40, 80)
    GUICtrlSetState(-1, $GUI_CHECKED)
    GUICtrlSetState(-1, $GUI_DISABLE)
    Global $rOrderOrt = GUICtrlCreateRadio('  Ort', 379, 40, 80)
    GUICtrlSetState(-1, $GUI_DISABLE)
    
    GUICtrlSetOnEvent($rPLZ, '_RadioClick')
    GUICtrlSetOnEvent($rORT, '_RadioClick')
    GUICtrlSetOnEvent($rBULA, '_RadioClick')
    GUICtrlSetOnEvent($rKREIS, '_RadioClick')
    GUICtrlSetOnEvent($rOrderPlz, '_SubRadioClick')
    GUICtrlSetOnEvent($rOrderOrt, '_SubRadioClick')
    
    GUICtrlCreateLabel('Suchbegriff', 32, 73)
    Global $inSearchWord = GUICtrlCreateInput('', 133, 70, 330)
    
    Global $hListview = GuiCtrlCreateListView('PLZ|Ort|Bundesland|Landkreis', 10, 100, 460, 190, -1, BitOR($LVS_EX_DOUBLEBUFFER,$LVS_EX_GRIDLINES))
    _GUICtrlListView_SetColumnWidth($hListview, 0, 60)
    _GUICtrlListView_SetColumnWidth($hListview, 1, 135)
    _GUICtrlListView_SetColumnWidth($hListview, 2, 135)
    _GUICtrlListView_SetColumnWidth($hListview, 3, $LVSCW_AUTOSIZE_USEHEADER)
    
    
    GUISetState()
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
    
    While True
        Sleep(50)
    WEnd
    
    Func _Exit()
        _ExitSQLite()
        Exit
    EndFunc
    
    Func _RadioClick()
        _ClearListview()
        Switch @GUI_CtrlId
            Case $rPLZ
                _EnDisAbleSortOrder($GUI_DISABLE)
                $sUserSearchField = 'plz'
                _GUICtrlListView_SetColumnOrder($hListview, '0|1|2|3')
            Case $rORT
                _EnDisAbleSortOrder($GUI_DISABLE)
                $sUserSearchField = 'ort'
                _GUICtrlListView_SetColumnOrder($hListview, '1|0|2|3')
            Case $rKREIS, $rBULA
                _EnDisAbleSortOrder($GUI_ENABLE)
                $sUserSearchField = @GUI_CtrlId = $rKREIS ? 'kreis' : 'bula'
                $sUserSearchField &= (BitAND(GUICtrlRead($rOrderPlz),$GUI_CHECKED) ? '-plz-ort' : '-ort-plz')
                If BitAND(GUICtrlRead($rOrderPlz),$GUI_CHECKED) Then
                    _SetColumnOrder(@GUI_CtrlId, $rOrderPlz)
                Else
                    _SetColumnOrder(@GUI_CtrlId, $rOrderOrt)
                EndIf
        EndSwitch
    EndFunc
    
    Func _SubRadioClick()
        _ClearListview()
        $sUserSearchField = BitAND(GUICtrlRead($rKREIS),$GUI_CHECKED) ? 'kreis' : 'bula'
        $sUserSearchField &= (BitAND(GUICtrlRead($rOrderPlz),$GUI_CHECKED) ? '-plz-ort' : '-ort-plz')
        If BitAND(GUICtrlRead($rKREIS),$GUI_CHECKED) Then
            _SetColumnOrder($rKREIS, @GUI_CtrlId)
        Else
            _SetColumnOrder($rBULA, @GUI_CtrlId)
        EndIf
    EndFunc
    
    Func _SetColumnOrder($rMain, $rSub)
        If $rMain = $rKREIS And BitAND(GUICtrlRead($rOrderPlz),$GUI_CHECKED) Then ; 'kreis-plz-ort-bula'
            _GUICtrlListView_SetColumnOrder($hListview, '3|0|1|2')
        ElseIf $rMain = $rKREIS And BitAND(GUICtrlRead($rOrderOrt),$GUI_CHECKED) Then ; 'kreis-ort-plz-bula'
            _GUICtrlListView_SetColumnOrder($hListview, '3|1|0|2')
        ElseIf $rMain = $rBULA And BitAND(GUICtrlRead($rOrderPlz),$GUI_CHECKED) Then ; 'bula-plz-ort-kreis'
            _GUICtrlListView_SetColumnOrder($hListview, '2|0|1|3')
        ElseIf $rMain = $rBULA And BitAND(GUICtrlRead($rOrderOrt),$GUI_CHECKED) Then ; 'bula-ort-plz-kreis'
            _GUICtrlListView_SetColumnOrder($hListview, '2|1|0|3')
        EndIf
    EndFunc
    
    Func _EnDisAbleSortOrder($iState)
        GUICtrlSetState($lbOrder,$iState)
        GUICtrlSetState($rOrderOrt,$iState)
        GUICtrlSetState($rOrderPlz,$iState)
        GUICtrlSetData($inSearchWord, '')
    EndFunc
    
    Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
        Local $iIDFrom, $iCode, $hWndEdit, $sRead, $index
        $hWndEdit = GUICtrlGetHandle($inSearchWord)
        $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
        $iCode = BitShift($iwParam, 16) ; Hi Word
        Switch $ilParam
            Case $hWndEdit
                Switch $iCode
                    Case $EN_CHANGE
                        _ClearListview()
                        $sUserValue = GUICtrlRead($iIDFrom)
                        If ($sUserValue = '')  Or _
                           ($sUserSearchField = 'ort' And StringLen($sUserValue) < 3) Then Return $GUI_RUNDEFMSG
                        _PLZSearch_CreateLVItem($sUserValue, $sUserSearchField)
                EndSwitch
        EndSwitch
        Return $GUI_RUNDEFMSG
    EndFunc   ;==>WM_COMMAND
    
    Func _ClearListview()
        _GUICtrlListView_DeleteAllItems($hListview)
    EndFunc
    
    Func _FillListview(ByRef $aItem)
        Local $iUbound = UBound($aItem)
        If $iUbound = 1 Then Return
        _GUICtrlListView_BeginUpdate($hListview)
        For $i = 1 To $iUbound -1
            GUICtrlCreateListViewItem(StringFormat('%s|%s|%s|%s', $aItem[$i][0], $aItem[$i][1], $aItem[$i][2], $aItem[$i][3]), $hListview)
        Next
        _GUICtrlListView_EndUpdate($hListview)
    EndFunc
    
    Func _PLZSearch_CreateLVItem($sSearch, $sFieldOrder)
        Local $sQuery = ''
        Switch $sFieldOrder
            Case 'plz'
                $sQuery = "SELECT plz,ort,bula,kreis FROM plz WHERE plz LIKE '" & $sSearch & "%' ORDER BY plz,ort,bula,kreis;"
            Case 'ort'
                $sQuery = "SELECT ort,plz,bula,kreis FROM plz WHERE ort LIKE '" & $sSearch & "%' ORDER BY ort,plz,bula,kreis;"
            Case 'bula-plz-ort'
                $sQuery = "SELECT bula,plz,ort,kreis FROM plz WHERE bula LIKE '" & $sSearch & "%' ORDER BY bula,plz,ort,kreis;"
            Case 'bula-ort-plz'
                $sQuery = "SELECT bula,ort,plz,kreis FROM plz WHERE bula LIKE '" & $sSearch & "%' ORDER BY bula,ort,plz,kreis;"
            Case 'kreis-plz-ort'
                $sQuery = "SELECT kreis,plz,ort,bula FROM plz WHERE kreis LIKE '" & $sSearch & "%' ORDER BY kreis,plz,ort,bula;"
            Case 'kreis-ort-plz'
                $sQuery = "SELECT kreis,ort,plz,bula FROM plz WHERE kreis LIKE '" & $sSearch & "%' ORDER BY kreis,ort,plz,bula;"
        EndSwitch
    
        _GUICtrlListView_BeginUpdate($hListview)
        Local $hQuery, $aRow, $aColumns
        _SQLite_Query($hSQL, $sQuery, $hQuery)
    
    #region - DEGUG Spaltenreihenfolge
        _SQLite_FetchNames($hQuery, $aColumns)
        Local $sCol = StringFormat('%s-%s-%s-%s', $aColumns[0], $aColumns[1], $aColumns[2], $aColumns[3])
        ConsoleWrite("@@ DEBUG Spaltenreihenfolge Ergebnisarray: " & @TAB & $sCol & @LF)
    ;~     GUICtrlCreateListViewItem(StringFormat('%s|%s|%s|%s', $aColumns[0], $aColumns[1], $aColumns[2], $aColumns[3]), $hListview)
    #endregion - DEGUG Spaltenreihenfolge
    
        While _SQLite_FetchData($hQuery, $aRow, False, False) = $SQLITE_OK
            GUICtrlCreateListViewItem(StringFormat('%s|%s|%s|%s', $aRow[0], $aRow[1], $aRow[2], $aRow[3]), $hListview)
        WEnd
    
        _SQLite_QueryFinalize($hQuery)
        _GUICtrlListView_EndUpdate($hListview)
    EndFunc
    
    
    Func _ExitSQLite()
        _SQLite_Close()
        _SQLite_Shutdown()
    EndFunc
    Alles anzeigen

    Dateien

    PLZ.zip 572,99 kB – 488 Downloads
  • Forenupdate - September 2017 - Probleme / Anregungen / Feedback - Sammelthread

    • BugFix
    • 2. September 2017 um 08:59

    Als sehr unangenehm empfinde ich:

    Letzte Aktivitäten

    Auch wenn diese Inhalte gelesen wurden, bleiben sie oben stehen und blockieren den Blick auf die Themenübersicht. Das Hauptproblem ist eigentlich, dass jeder Post als eigene Aktivität betrachtet wird, statt alle Aktivitäten in einem Thread zusammen zu betrachten.

    Mein Wunsch: Auswahlmöglichkeit bei den Einstellungen: "Letzte Aktivitäten" anzeigen An/Aus

  • Windows Systemprogramm versteckt starten

    • BugFix
    • 30. August 2017 um 18:37
    Zitat von misterspeed

    Selbst ein späteres verstecken statt schließen ist scheinbar nicht möglich.

    Das funktioniert bei mir problemlos.

    AutoIt
    Local $aApp[2][2] = [['mspaint.exe','MSPaintApp'],['calc.exe','CalcFrame']]
    Local $iPID, $hWnd
    
    
    
    
    For $i = 0 To 1
    	$iPID = Run(StringFormat('%s\%s', @SystemDir, $aApp[$i][0]), '', @SW_HIDE)
    	If Not $iPID Then ContinueLoop
    ConsoleWrite(StringFormat('"%s" gestartet.', $aApp[$i][0]) & @CRLF)
    
    
    	$hWnd = WinWait(StringFormat('[CLASS:%s]', $aApp[$i][1]), '', 10)
    	If Not IsHWnd($hWnd) Then
    		ProcessClose($iPID)
    	Else
    		If MsgBox(4, 'Versteckt starten', 'Ist "' & $aApp[$i][0] & '" sichtbar?') = 7 Then
    			WinSetState($hWnd, '', @SW_SHOW)
    			WinActivate($hWnd)
    			MsgBox(0, 'Schliessen', '"' & $aApp[$i][0] & '" wurde sichtbar, jetzt beenden.')
    			ProcessClose($iPID)
    ConsoleWrite(StringFormat('"%s" geschlossen.', $aApp[$i][0]) & @CRLF)
    		Else
    			MsgBox(0, 'Verstecken', '"' & $aApp[$i][0] & '" wird versteckt')
    			WinSetState($hWnd, '', @SW_HIDE)
    			MsgBox(0, 'Schliessen', '"' & $aApp[$i][0] & '" wird geschlossen')
    			ProcessClose($iPID)
    ConsoleWrite(StringFormat('"%s" geschlossen.', $aApp[$i][0]) & @CRLF)
    		EndIf
    	EndIf
    Next
    Alles anzeigen
  • Windows Systemprogramm versteckt starten

    • BugFix
    • 30. August 2017 um 18:30
    Zitat von Sonderbaar

    Autoit-Gott

    :Face:
    Wie kommst du auf sowas? Es gibt so einige Gebiete, zu denen ich nur sehr begrenzte Kenntnisse habe und bei Bedarf auch gerne Hilfe in Anspruch nehme.

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™