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

Beiträge von Trolleule1337

  • DLLCall und Absturz: Exit Code -1073741819

    • Trolleule1337
    • 17. September 2013 um 18:11

    Hmm also die Enumerationen geben als Wert ganze Zahlen zurück, dafür habe ich int gewählt, wenn ich dann noch für den PackageName WCHAR [64] oder WCHAR [96] verwende klappt es. Wenn ich Byte statt int nehme stürzt es ab, wenn ich int als Array nehme bekomme ich Müll.

    Also den Datentyp als Array zu übergeben halte ich für falsch... ne iDee?

  • DLLCall und Absturz: Exit Code -1073741819

    • Trolleule1337
    • 17. September 2013 um 16:55

    Das ist übrigens nicht die einzige Funktion der API bei der das Problem auftritt. Und was ich noch beobachtet habe. Manchmal klappt es auch problemlos, aber es stürzt häufiger ab als es funktioniert.

  • DLLCall und Absturz: Exit Code -1073741819

    • Trolleule1337
    • 17. September 2013 um 16:48

    oki hier die main:

    [autoit]

    Func _DISM_GetPackageInfo($Session, $Identifier, ByRef $CustomProperty, ByRef $Feature, $PackageIdentifier = $DismPackageName, $OutputFormat = 0)

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

    Local $aResult = DllCall($ghdismapi, "LONG", "DismGetPackageInfo", _
    "PTR", $Session, _
    "WSTR", $Identifier, _
    "INT", $PackageIdentifier, _
    "PTR*", 0 _ ; out
    )
    If @error Then Return SetError(@error, @extended, 0)
    If IsArray($aResult) = 1 Then
    If $aResult[0] <> $S_OK Then Return SetError(@error, @extended, $aResult[0])
    EndIf

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

    Local $PackageInfo = $aResult[4] ; get pointer to struct
    If $PackageInfo <> 0 Then ; if pointer not empty
    ; create DismPackageInfo Structure
    Local $PackageInfo_struct = DllStructCreate($tagDismPackageInfo, $PackageInfo)

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

    Local $oPackageInfo_dict = ObjCreate("Scripting.Dictionary") ; store package info data in dictionay

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

    ; get package info data
    $oPackageInfo_dict.add("PackageName", DllStructGetData(DllStructCreate("WCHAR [260]", DllStructGetData($PackageInfo_struct, "PackageName")), 1))
    $oPackageInfo_dict.add("PackageState", _DISM_GetPackageFeatureState(DllStructGetData($PackageInfo_struct, "PackageState")))
    $oPackageInfo_dict.add("ReleaseType", _DISM_GetReleaseType(DllStructGetData($PackageInfo_struct, "ReleaseType")))

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

    Local $InstallTime_struct = DllStructCreate($tagSYSTEMTIME, DllStructGetPtr($PackageInfo_struct, 4)) ; index = 4

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

    $oPackageInfo_dict.add("InstallTime", _Date_Time_SystemTimeToDateTimeStr($InstallTime_struct, 1))
    $oPackageInfo_dict.add("Applicable", DllStructGetData($PackageInfo_struct, "Applicable"))
    $oPackageInfo_dict.add("Copyright", DllStructGetData(DllStructCreate("WCHAR [260]", DllStructGetData($PackageInfo_struct, "Copyright")), 1))
    $oPackageInfo_dict.add("Company", DllStructGetData(DllStructCreate("WCHAR [260]", DllStructGetData($PackageInfo_struct, "Company")), 1))

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

    Local $CreationTime_struct = DllStructCreate($tagSYSTEMTIME, DllStructGetPtr($PackageInfo_struct, 15)) ; index = 15

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

    $oPackageInfo_dict.add("CreationTime", _Date_Time_SystemTimeToDateTimeStr($CreationTime_struct, 1))
    $oPackageInfo_dict.add("DisplayName", DllStructGetData(DllStructCreate("WCHAR [260]", DllStructGetData($PackageInfo_struct, "DisplayName")), 1))
    $oPackageInfo_dict.add("Description", DllStructGetData(DllStructCreate("WCHAR [260]", DllStructGetData($PackageInfo_struct, "Description")), 1))
    $oPackageInfo_dict.add("InstallClient", DllStructGetData(DllStructCreate("WCHAR [64]", DllStructGetData($PackageInfo_struct, "InstallClient")), 1))

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

    ;~ Local $ptr = DllStructGetData($PackageInfo_struct, "InstallClient")
    ;~ If Not IsPtr($ptr) Then Exit MsgBox(0, 'FEHLER', "InstallClient ist kein Pointer")
    ;~ Local $struct = DllStructCreate("WCHAR[260]", $ptr)
    ;~ ConsoleWrite( DllStructGetData($struct, 1) & @LF)

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

    $oPackageInfo_dict.add("InstallPackageName", DllStructGetData(DllStructCreate("WCHAR [260]", DllStructGetData($PackageInfo_struct, "InstallPackageName")), 1))

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

    Local $LastUpdateTime_struct = DllStructCreate($tagSYSTEMTIME, DllStructGetPtr($PackageInfo_struct, 27)) ; index = 27

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

    $oPackageInfo_dict.add("LastUpdateTime", _Date_Time_SystemTimeToDateTimeStr($LastUpdateTime_struct, 1))
    $oPackageInfo_dict.add("ProductName", DllStructGetData(DllStructCreate("WCHAR [260]", DllStructGetData($PackageInfo_struct, "ProductName")), 1))
    $oPackageInfo_dict.add("ProductVersion", DllStructGetData(DllStructCreate("WCHAR [260]", DllStructGetData($PackageInfo_struct, "ProductVersion")), 1))
    $oPackageInfo_dict.add("RestartRequired", _DISM_GetRestartType(DllStructGetData($PackageInfo_struct, "RestartRequired")))
    $oPackageInfo_dict.add("FullyOffline", _DISM_GetFullyOfflineInstallableType(DllStructGetData($PackageInfo_struct, "FullyOffline")))
    $oPackageInfo_dict.add("SupportInformation", DllStructGetData(DllStructCreate("WCHAR [260]", DllStructGetData($PackageInfo_struct, "SupportInformation")), 1))

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

    ; get custom property data
    Local $CustomPropertyCount = DllStructGetData($PackageInfo_struct, "CustomPropertyCount")
    If $CustomPropertyCount <> 0 Then
    Local $oCustomProperty_list = ObjCreate("System.Collections.ArrayList")
    For $properties = 1 To $CustomPropertyCount
    Local $oCustomProperty_dict = ObjCreate("Scripting.Dictionary") ; store custom property data in dictionay
    ; create DismCustomProperty Structure
    Local $CustomProperty_struct = DllStructCreate($tagDismCustomProperty, DllStructGetPtr($PackageInfo_struct, DetermineLocation($tagDismCustomProperty, 1, 1))) ; offset = 1
    ; get custom property data
    $oCustomProperty_dict.add("Name", DllStructGetData(DllStructCreate("WCHAR [260]", DllStructGetData($CustomProperty_struct, "Name")), 1))
    $oCustomProperty_dict.add("Value", DllStructGetData(DllStructCreate("WCHAR [260]", DllStructGetData($CustomProperty_struct, "Value")), 1))
    $oCustomProperty_dict.add("Path", DllStructGetData(DllStructCreate("WCHAR [260]", DllStructGetData($CustomProperty_struct, "Path")), 1))
    $oCustomProperty_list.add($oCustomProperty_dict) ; add dict to list
    Next

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

    ; free resources
    _DISM_Delete($CustomProperty_struct)

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

    Local $CustomProperty_array[$CustomPropertyCount+1][3], $j = 1
    #Region - Create 2d-array
    For $property in $oCustomProperty_list.add
    Local $i = 0
    For $keys in $property.Keys
    If $j = 1 Then $CustomProperty_array[0][$i] = $keys ; array title
    $CustomProperty_array[$j][$i] = $property($keys)
    $i+=1
    Next
    $j+=1
    Next

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

    $CustomProperty = $CustomProperty_array
    EndIf

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

    ; get feature data
    Local $FeatureCount = DllStructGetData($PackageInfo_struct, "FeatureCount")
    If $FeatureCount <> 0 Then
    Local $oFeature_list = ObjCreate("System.Collections.ArrayList")
    For $features = 1 To $FeatureCount
    Local $oFeature_dict = ObjCreate("Scripting.Dictionary") ; store feature data in dictionay
    ; create DismFeature Structure
    Local $Feature_struct = DllStructCreate($tagDismFeature, DllStructGetPtr($PackageInfo_struct, DetermineLocation($tagDismFeature, 1, 1))) ; offset = 1
    ; get feature data
    $oFeature_dict.add("FeatureName", DllStructGetData(DllStructCreate("WCHAR [260]", DllStructGetData($Feature_struct, "FeatureName")), 1))
    $oFeature_dict.add("State", _DISM_GetPackageFeatureState(DllStructGetData($Feature_struct, "State")))
    $oFeature_list.add($oFeature_dict) ; add dict to list
    Next

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

    ; free resources
    _DISM_Delete($Feature_struct)

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

    Local $Feature_array[$FeatureCount+1][2], $j = 1
    #Region - Create 2d-array
    For $feature in $oFeature_list
    Local $i = 0
    For $keys in $feature.Keys
    If $j = 1 Then $Feature_array[0][$i] = $keys ; array title
    $Feature_array[$j][$i] = $feature($keys)
    $i+=1
    Next
    $j+=1
    Next

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

    $Feature = $Feature_array
    EndIf

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

    ; free resources
    _DISM_Delete($PackageInfo_struct)
    _DISM_Delete($InstallTime_struct)
    _DISM_Delete($CreationTime_struct)
    _DISM_Delete($LastUpdateTime_struct)

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

    If $OutputFormat = 1 Then
    Local $PackageInfo_array[2][18], $i = 0
    #Region - Create 2d-array
    For $keys in $oPackageInfo_dict.Keys
    $PackageInfo_array[0][$i] = $keys ; array title
    $PackageInfo_array[1][$i] = $oPackageInfo_dict($keys)
    $i+=1
    Next
    #EndRegion - Create 2d-array
    Return SetExtended(_WinAPI_GetLastError(), $PackageInfo_array)
    EndIf

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

    Return SetExtended(_WinAPI_GetLastError(), $oPackageInfo_dict)
    EndIf

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

    Return SetExtended(_WinAPI_GetLastError(), $aResult[0])
    EndFunc ;==>_DISM_GetPackageInfo

    [/autoit]

    Hier die Enus:

    [autoit]

    ; #ENUMS# =======================================================================================================================
    ; DismLogLevel
    Global Enum _
    $DismLogErrors, _
    $DismLogErrorsWarnings, _
    $DismLogErrorsWarningsInfo

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

    ; DismImageIdentifier
    Global Enum _
    $DismImageIndex, _
    $DismImageName

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

    ; DismMountMode
    Global Enum _
    $DismReadWrite, _
    $DismReadOnly

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

    ; DismImageType
    Global Enum _
    $DismImageTypeUnsupported = -1, _
    $DismImageTypeWim, _
    $DismImageTypeVhd

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

    ; DismImageBootable
    Global Enum _
    $DismImageBootableYes, _
    $DismImageBootableNo, _
    $DismImageBootableUnknown

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

    ; DismMountStatus
    Global Enum _
    $DismMountStatusOk, _
    $DismMountStatusNeedsRemount, _
    $DismMountStatusInvalid

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

    ; DismImageHealthState
    Global Enum _
    $DismImageHealthy, _
    $DismImageRepairable, _
    $DismImageNonRepairable

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

    ; DismPackageIdentifier
    Global Enum _
    $DismPackageNone, _
    $DismPackageName, _
    $DismPackagePath

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

    ; DismPackageFeatureState
    Global Enum _
    $DismStateNotPresent, _
    $DismStateUninstallPending, _
    $DismStateStaged, _
    $DismStateResolved, _
    $DismStateRemoved = $DismStateResolved, _
    $DismStateInstalled, _
    $DismStateInstallPending, _
    $DismStateSuperseded, _
    $DismStatePartiallyInstalled

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

    ; DismReleaseType
    Global Enum _
    $DismReleaseTypeCriticalUpdate, _
    $DismReleaseTypeDriver, _
    $DismReleaseTypeFeaturePack, _
    $DismReleaseTypeHotfix, _
    $DismReleaseTypeSecurityUpdate, _
    $DismReleaseTypeSoftwareUpdate, _
    $DismReleaseTypeUpdate, _
    $DismReleaseTypeUpdateRollup, _
    $DismReleaseTypeLanguagePack, _
    $DismReleaseTypeFoundation, _
    $DismReleaseTypeServicePack, _
    $DismReleaseTypeProduct, _
    $DismReleaseTypeLocalPack, _
    $DismReleaseTypeOther

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

    ; DismRestartType
    Global Enum _
    $DismRestartNo, _
    $DismRestartPossible, _
    $DismRestartRequired

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

    ; DismDriverSignature
    Global Enum _
    $DismDriverSignatureUnknown, _
    $DismDriverSignatureUnsigned, _
    $DismDriverSignatureSigned

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

    ; DismFullyOfflineInstallableType
    Global Enum _
    $DismFullyOfflineInstallable, _
    $DismFullyOfflineNotInstallable, _
    $DismFullyOfflineInstallableUndetermined
    ; ===============================================================================================================================

    [/autoit]

    Und hier die Übersetzung:

    [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _DISM_GetPackageFeatureState
    ; Description ...: Converts a DismPackageFeatureState Enumeration Value to its Constant Name
    ; Syntax.........: _DISM_GetPackageFeatureState($PackageState)
    ; Parameters ....: $PackageState - Specifies the state of a package or a feature.
    ; | 0 - $DismStateNotPresent
    ; | 1 - $DismStateUninstallPending
    ; | 2 - $DismStateStaged
    ; | 3 - $DismStateResolved
    ; | 3 - $DismStateRemoved
    ; | 4 - $DismStateInstalled
    ; | 5 - $DismStateInstallPending
    ; | 6 - $DismStateSuperseded
    ; | 7 - $DismStatePartiallyInstalled
    ; Return values .: Success - Returns $PackageState
    ; | NotPresent - The package or feature is not present.
    ; | UninstallPending - An uninstall process for the package or feature is pending. Additional processes are pending and must be completed before the package or feature is successfully uninstalled.
    ; | Staged - The package or feature is staged.
    ; | Resolved - Metadata about the package or feature has been added to the system, but the package or feature is not present.
    ; | Removed - Same as StateResolved
    ; | Installed - The package or feature is installed.
    ; | InstallPending - The install process for the package or feature is pending. Additional processes are pending and must be completed before the package or feature is successfully installed.
    ; | Superseded - The package or feature has been superseded by a more recent package or feature.
    ; | PartiallyInstalled - The package or feature is partially installed. Some parts of the package or feature have not been installed.
    ; Failure - Not implemented
    ; Author(s) .....: André Cut
    ; Modified.......:
    ; Remarks .......:
    ; Related .......: _DISM_GetReleaseType, _DISM_GetRestartType, _DISM_GetFullyOfflineInstallableType, _DISM_GetMountStatus, _DISM_GetMountMode, _DISM_GetImageBootable, _DISM_GetImageType
    ;
    ; ===============================================================================================================================
    Func _DISM_GetPackageFeatureState($PackageState)
    Switch $PackageState
    Case $DismStateNotPresent
    $PackageState = "NotPresent"
    Case $DismStateUninstallPending
    $PackageState = "UninstallPending"
    Case $DismStateStaged
    $PackageState = "Staged"
    Case $DismStateRemoved, $DismStateResolved
    $PackageState = "Resolved"
    Case $DismStateInstalled
    $PackageState = "Installed"
    Case $DismStateInstallPending
    $PackageState = "InstallPending"
    Case $DismStateSuperseded
    $PackageState = "Superseded"
    Case $DismStatePartiallyInstalled
    $PackageState = "PartiallyInstalled"
    EndSwitch
    Return $PackageState
    EndFunc ;==>_DISM_GetPackageFeatureState

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _DISM_GetReleaseType
    ; Description ...: Converts a DismPackageFeatureState Enumeration Value to its Constant Name
    ; Syntax.........: _DISM_GetReleaseType($ReleaseType)
    ; Parameters ....: $ReleaseType - Specifies the release type of a package.
    ; | 0 - $DismReleaseTypeCriticalUpdate
    ; | 1 - $DismReleaseTypeDriver
    ; | 2 - $DismReleaseTypeFeaturePack
    ; | 3 - $DismReleaseTypeHotfix
    ; | 4 - $DismReleaseTypeSecurityUpdate
    ; | 5 - $DismReleaseTypeSoftwareUpdate
    ; | 6 - $DismReleaseTypeUpdate
    ; | 7 - $DismReleaseTypeUpdateRollup
    ; | 8 - $DismReleaseTypeLanguagePack
    ; | 9 - $DismReleaseTypeFoundation
    ; | 10 - $DismReleaseTypeServicePack
    ; | 11 - $DismReleaseTypeProduct
    ; | 12 - $DismReleaseTypeLocalPack
    ; | 13 - $DismReleaseTypeOther
    ; Return values .: Success - Returns $ReleaseType
    ; | CriticalUpdate - The package is a critical update.
    ; | Driver - The package is a driver.
    ; | FeaturePack - The package is a feature pack.
    ; | Hotfix - The package is a hotfix.
    ; | SecurityUpdate - The package is a security update.
    ; | SoftwareUpdate - The package is a software update.
    ; | Update - The package is a general update.
    ; | UpdateRollup - The package is an update rollup.
    ; | LanguagePack - The package is a language pack.
    ; | Foundation - The package is a foundation package.
    ; | ServicePack - The package is a service pack.
    ; | Product - The package is a product release.
    ; | LocalPack - The package is a local pack.
    ; | Other - The package is another type of release.
    ; Failure - Not implemented
    ; Author(s) .....: André Cut
    ; Modified.......:
    ; Remarks .......:
    ; Related .......: _DISM_GetPackageFeatureState, _DISM_GetRestartType, _DISM_GetFullyOfflineInstallableType, _DISM_GetMountStatus, _DISM_GetMountMode, _DISM_GetImageBootable, _DISM_GetImageType
    ;
    ; ===============================================================================================================================
    Func _DISM_GetReleaseType($ReleaseType)
    Switch $ReleaseType
    Case $DismReleaseTypeCriticalUpdate
    $ReleaseType = "CriticalUpdate"
    Case $DismReleaseTypeDriver
    $ReleaseType = "Driver"
    Case $DismReleaseTypeFeaturePack
    $ReleaseType = "FeaturePack"
    Case $DismReleaseTypeHotfix
    $ReleaseType = "HotFix"
    Case $DismReleaseTypeSecurityUpdate
    $ReleaseType = "SecurityUpdate"
    Case $DismReleaseTypeSoftwareUpdate
    $ReleaseType = "SoftwareUpdate"
    Case $DismReleaseTypeUpdate
    $ReleaseType = "Update"
    Case $DismReleaseTypeUpdateRollup
    $ReleaseType = "UpdateRollup"
    Case $DismReleaseTypeLanguagePack
    $ReleaseType = "LanguagePack"
    Case $DismReleaseTypeFoundation
    $ReleaseType = "Foundation"
    Case $DismReleaseTypeServicePack
    $ReleaseType = "ServicePack"
    Case $DismReleaseTypeProduct
    $ReleaseType = "Product"
    Case $DismReleaseTypeLocalPack
    $ReleaseType = "LocalPack"
    Case $DismReleaseTypeOther
    $ReleaseType = "Other"
    EndSwitch
    Return $ReleaseType
    EndFunc ;==>_DISM_GetReleaseType

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _DISM_GetRestartType
    ; Description ...: Converts a DismRestartType Enumeration Value to its Constant Name
    ; Syntax.........: _DISM_GetRestartType($RestartType)
    ; Parameters ....: $RestartType - Specifies whether a restart is required after enabling a feature or installing a package.
    ; | 0 - $DismRestartNo
    ; | 1 - $DismRestartPossible
    ; | 2 - $DismRestartRequired
    ; Return values .: Success - Returns $RestartType
    ; | No - No restart is required.
    ; | Possible - This package or feature might require a restart.
    ; | Required - This package or feature always requires a restart.
    ; Failure - Not implemented
    ; Author(s) .....: André Cut
    ; Modified.......:
    ; Remarks .......:
    ; Related .......: _DISM_GetPackageFeatureState, _DISM_GetReleaseType, _DISM_GetFullyOfflineInstallableType, _DISM_GetMountStatus, _DISM_GetMountMode, _DISM_GetImageBootable, _DISM_GetImageType
    ;
    ; ===============================================================================================================================
    Func _DISM_GetRestartType($RestartType)
    Switch $RestartType
    Case $DismRestartNo
    $RestartType = "No"
    Case $DismRestartPossible
    $RestartType = "Possible"
    Case $DismRestartRequired
    $RestartType = "Required"
    EndSwitch
    Return $RestartType
    EndFunc ;==>_DISM_GetRestartType

    [/autoit]


    Alles da?

  • DLLCall und Absturz: Exit Code -1073741819

    • Trolleule1337
    • 17. September 2013 um 15:49

    Ja bin sicher: Hier der Aufbau des structs

    Code
    typedef struct _DismPackageInfo
    {
        PCWSTR PackageName;
        DismPackageFeatureState PackageState;
        DismReleaseType ReleaseType;
        SYSTEMTIME InstallTime;
        BOOL Applicable;
        PCWSTR Copyright;
        PCWSTR Company;
        SYSTEMTIME CreationTime;
        PCWSTR DisplayName;
        PCWSTR Description;
        PCWSTR InstallClient;
        PCWSTR InstallPackageName;
        SYSTEMTIME LastUpdateTime;
        PCWSTR ProductName;
        PCWSTR ProductVersion;
        DismRestartType RestartRequired;
        DismFullyOfflineInstallableType FullyOffline;
        PCWSTR SupportInformation;
        DismCustomProperty* CustomProperty;
        UINT CustomPropertyCount;
        DismFeature* Feature;
        UINT FeatureCount;
    }
    Alles anzeigen

    Link: http://msdn.microsoft.com/en-us/library/…p/hh824774.aspx


    siehe InstallClient

  • DLLCall und Absturz: Exit Code -1073741819

    • Trolleule1337
    • 17. September 2013 um 15:40

    Den Pointer zu checken hatte ich auch schon versucht. Also was du sagst, alpines, ist das Ergebnis von BugFix. Habe es nochmal versucht. Das ConsolWrite führt er nicht aus, weil AutoIt vorher abstürzt und auf die Abfrage springt er nicht an weil der pointer ok ist.
    Das Problem ist:

    [autoit]

    $struct = DllStructCreate("WCHAR[260]", $ptr)

    [/autoit]
  • DLLCall und Absturz: Exit Code -1073741819

    • Trolleule1337
    • 17. September 2013 um 14:56

    Hi,
    diese Zeile hier verursacht den Absturz:

    [autoit]

    DllStructGetData(DllStructCreate("WCHAR [260]", DllStructGetData($PackageInfo_struct, "InstallClient")), 1))

    [/autoit]

    Habe mir den Rest gespart, weil ich das Problem gefunden habe, glaube ich. Wenn ich nämlich die Länge des chars verändere, klappt es. z.B. klappt es bei "WCHAR [64]", die Frage ist nur wieso? Ich habe bisher alle Daten des Typs PCWSTR mit WCHAR [260] definiert und es hat nie Probleme gemacht. Hat jemand eine Idee?

    Danke jungs!

  • Array Deklaration als Parameter übergeben

    • Trolleule1337
    • 1. August 2013 um 22:25

    Jo danke BugFix, auch auf die Idee bin ich schon gekommen. Schade das AutoIt so viele limitations hat :(

  • Array Deklaration als Parameter übergeben

    • Trolleule1337
    • 1. August 2013 um 22:06

    Wenn ich StringSplit benutze und ein Dictionary mit reingebe, verliert es logischerweise die Daten und sowieso kann ich nicht mit strings arbeiten, wo handles und IDs benötigt werden.

    Ich brauch eine Funktion, die n-Parameter aufnimmt, daraus ein Array bildet und es zurückgibt.
    Geht sowas?

  • Array Deklaration als Parameter übergeben

    • Trolleule1337
    • 1. August 2013 um 21:21

    An eine Funktion hatte ich auch schon gedacht. Ich brauche die Deklaration des Array nicht, so spare ich mir die Zeile und es wird übersichtlicher, vorallem wenn man mehrere Aufrufe der selben Funktion hat, aber mit anderen Parametern.

    Dachte mir schon, das es nicht direkt möglich ist. Danke.

  • Array Deklaration als Parameter übergeben

    • Trolleule1337
    • 1. August 2013 um 20:46

    Hi Leute,
    ist sowas ähnliches vllt. möglich?

    [autoit]


    Test([$a, $b, $c, $d])

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

    Func Test($aArray)
    ; mach was
    EndFunc

    [/autoit]

    Hat was von python und anderen, hat jemand ne idee, ob das irgendwie möglich ist?

    Danke!

  • ListView mit Checkboxen und Edit Controls V2

    • Trolleule1337
    • 22. Juli 2013 um 22:20

    Jemand ne Idee?

  • ListView mit Checkboxen und Edit Controls V2

    • Trolleule1337
    • 21. Juli 2013 um 13:48

    So jetzt läufts prima und das alles unter 2s :thumbup:

    Das Einzige was mich stört ist Zeile 81: Wenn die Variablen nicht global definiert sind, kommt der scroll up nicht mehr mit. Also einmal komplett nach unten und danach wieder komplett nach oben scrollen, anstelle der 8 im Edit steht die 29. Vllt. hat jemand eine Idee dazu?


    [autoit]

    #include <GuiConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GuiListView.au3>
    #include <WinAPI.au3>
    #include <Array.au3>
    #include <GuiConstantsEx.au3>
    #include <GuiListView.au3>
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>
    #include <EditConstants.au3>
    #include <StaticConstants.au3>
    #include <GuiEdit.au3>
    #include <Constants.au3>
    #include <WinAPIEx.au3> ; from <a href='http://www.autoitscript.com/forum/topic/98712-winapiex-udf/' class='bbc_url' title=''>http://www.autoitscript.com/forum/topic/98712-winapiex-udf/</a>
    #include "ExListViewConstants.au3"
    #include <GuiButton.au3>
    Opt("GUIOnEventMode", 1)

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

    ; WM_MEASUREITEM allows setting the row height
    Global $lListView_row_height = 25
    GUIRegisterMsg($WM_MEASUREITEM, "WM_MEASUREITEM") ; place before listview creation - message sent once for each ownerdrawn control created

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

    Global $ids = 0

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

    Main()

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

    Func Main()
    Global $hListView
    Global $EditList = ObjCreate("System.Collections.ArrayList"), $BoxList = ObjCreate("System.Collections.ArrayList")

    $hGUI = GUICreate("ListView Set Item State", 700, 300)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Beenden")

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

    $iStyle = BitOR($LVS_REPORT, $LVS_OWNERDRAWFIXED, $LVS_SHOWSELALWAYS, $LVS_SINGLESEL) ; style
    $iExStyle = $LVS_EX_FULLROWSELECT ; extended style
    $hListView = _GUICtrlListView_Create($hGUI, "Items|SubItems|SubItems", 2, 2, 394, 252, $iStyle, $iExStyle)

    For $i = 1 To 30
    _GUICtrlListView_AddItem($hListView, "") ; text of first column
    $BoxList.add(_ListView_InsertControl($hListView, "", $i-1, 0, "CheckBox")) ; add sub item to column 1
    _GUICtrlListView_AddSubItem($hListView, $i-1, "SubItem " & $i-1, 1) ; add sub item to column 2
    $EditList.add(_ListView_InsertControl($hListView, "", $i-1, 2, "Edit")) ; add sub item to column 3
    Next

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

    ; first start
    $top = _SendMessage($hListView, $LVM_GETTOPINDEX) ; get top item
    _GUICtrlListView_SetItemSelected($hListView, $top) ; select top item
    _GUICtrlListView_SetItemFocused($hListView, $top) ; focus top item

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

    GUIRegisterMsg($WM_DRAWITEM, "WM_DRAWITEM")
    GUISetState()
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; place after GUISetState()
    EndFunc

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

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

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

    Func Beenden()
    Exit
    EndFunc

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

    Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
    Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    Local $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom")
    Local $nNotifyCode = DllStructGetData($tNMHDR, "Code")
    Local $hHeader = _GUICtrlListView_GetHeader($hListView) ; get header of listview control
    Local $items = _GUICtrlListView_GetCounterPage($hListView) ; get visible items
    Switch $hWndFrom
    Case $hListView
    Switch $nNotifyCode
    Case $LVN_BEGINSCROLL
    ; Notifies a list-view control's parent window when a scrolling operation starts
    Case $LVN_ENDSCROLL
    ; Notifies a list-view control's parent window when a scrolling operation ends
    Global $prevItem, $firstItem, $lastItem ; have to be global
    ; change top and last item on scroll up
    If $prevItem > _SendMessage($hListView, $LVM_GETTOPINDEX) Then
    $firstItem = _SendMessage($hListView, $LVM_GETTOPINDEX)
    ; change top and last item on scroll down
    Else
    $firstItem = _SendMessage($hListView, $LVM_GETTOPINDEX) ; get index of top item
    $lastItem = $firstItem+$items
    EndIf
    $prevItem = $firstItem ; get previous top item
    Local $lEdit, $lBox ; stores control data
    For $i = $firstItem To $lastItem
    If $i = 0 Then ContinueLoop
    $lEdit = $EditList.Item($i-1)
    $lBox = $BoxList.Item($i-1)
    _MoveControl($hListView, $lEdit.Item("hCtrl"), $lEdit.Item("sItemIndex"), $lEdit.Item("sSubItemIndex"))
    _MoveControl($hListView, $lBox.Item("hCtrl"), $lBox.Item("sItemIndex"), $lBox.Item("sSubItemIndex"))
    ; redraw text
    $sText = _GUICtrlEdit_GetText($lEdit.Item("hCtrl"))
    _GUICtrlEdit_SetText($lEdit.Item("hCtrl"), $sText)
    Next
    _GUICtrlListView_SetItemSelected($hListView, $firstItem) ; set selection
    _GUICtrlListView_SetItemFocused($hListView, $firstItem) ; set focus
    EndSwitch
    Case $hHeader
    Switch $nNotifyCode
    Case $HDN_ITEMCHANGEDW
    ; Notifies a header control's parent window that the attributes of a header item have changed
    Local $fItem = _SendMessage($hListView, $LVM_GETTOPINDEX) ; get index of top item
    Local $lItem = $fItem+$items
    For $i = $fItem To $lItem
    $lEdit = $EditList.Item($i)
    _MoveControl($hListView, $lEdit.Item("hCtrl"), $lEdit.Item("sItemIndex"), $lEdit.Item("sSubItemIndex"))
    _GUICtrlListView_SetItemState($hListView, $i, $LVIS_FOCUSED, $LVIS_FOCUSED)
    Next
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIFY

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

    Func WM_MEASUREITEM($hWnd, $Msg, $wParam, $lParam)
    Local $tMEASUREITEMS = DllStructCreate("uint cType;uint cID;uint itmID;uint itmW;uint itmH;ulong_ptr itmData", $lParam)
    If DllStructGetData($tMEASUREITEMS, "cType") <> $ODT_LISTVIEW Then Return $GUI_RUNDEFMSG
    DllStructSetData($tMEASUREITEMS, "itmH", $lListView_row_height) ; row height
    Return 1
    EndFunc ;==>WM_MEASUREITEM

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

    Func WM_DRAWITEM($hWnd, $Msg, $wParam, $lParam)
    Local $iColumnCount = _GUICtrlListView_GetColumnCount($hListView) ; get column count
    Local $aTextFormatting = BitOR($DT_VCENTER, $DT_SINGLELINE, $DT_CENTER, $DT_END_ELLIPSIS)
    Local $aRectMargins[4] = [6, -1, -4, 0]
    Local $tagDRAWITEMSTRUCT, $iBrushColor, $cID, $itmID, $itmAction, $itmState, $hItm, $hDC, $bSelected
    $timer = TimerInit()
    $tagDRAWITEMSTRUCT = DllStructCreate("uint cType;uint cID;uint itmID;uint itmAction;uint itmState;" & _
    "hwnd hItm;hwnd hDC;int itmRect[4];dword itmData", $lParam)
    If DllStructGetData($tagDRAWITEMSTRUCT, "cType") <> $ODT_LISTVIEW Then Return $GUI_RUNDEFMSG
    $cID = DllStructGetData($tagDRAWITEMSTRUCT, "cID")
    $itmID = DllStructGetData($tagDRAWITEMSTRUCT, "itmID")
    $itmAction = DllStructGetData($tagDRAWITEMSTRUCT, "itmAction")
    $itmState = DllStructGetData($tagDRAWITEMSTRUCT, "itmState")
    $hItm = DllStructGetData($tagDRAWITEMSTRUCT, "hItm")
    $hDC = DllStructGetData($tagDRAWITEMSTRUCT, "hDC")
    $bSelected = BitAND($itmState, $ODS_SELECTED)
    $bFocus = BitAND($itmState, $ODS_FOCUS) ; value: 16
    $bFocusSelected = BitOR($ODS_FOCUS, $ODS_SELECTED) ; item has focus and is selected. value: 17
    ;Local $hListView = ControlGetHandle($hWnd, "", $cID) ; get handle of listview control local
    Switch $itmAction
    Case $ODA_DRAWENTIRE
    ; change color of selected items
    Switch $itmState
    Case $ODS_SELECTED, $bfocusSelected
    ; The menu item's status is selected or is selected and has keyboard focus
    $iBrushColor = 0xEEDDBB
    Case $ODS_GRAYED
    ; The item is to be grayed. This bit is used only in a menu
    Case $ODS_DISABLED
    ; The item is to be drawn as disabled
    Case $ODS_CHECKED
    ; The menu item is to be checked. This bit is used only in a menu
    Case $ODS_FOCUS, $bSelected
    ; The item has the keyboard focus
    $iBrushColor = 0xFFFFFF
    Case $ODS_DEFAULT
    ; The item is the default item
    Case $ODS_COMBOBOXEDIT
    ; The drawing takes place in the selection field (edit control) of an owner-drawn combo box
    EndSwitch
    ; create a brush with the desired color
    Local $aBrush = DLLCall("gdi32.dll","hwnd","CreateSolidBrush", "int", $iBrushColor)
    ; get the rectangle for the whole row and fill it
    Local $iLeft = DllStructGetData($tagDRAWITEMSTRUCT, "itmRect", 1)
    DllStructSetData($tagDRAWITEMSTRUCT, "itmRect", $iLeft + 5, 1)
    _WinAPI_FillRect($hDC, DllStructGetPtr($tagDRAWITEMSTRUCT, "itmRect"), $aBrush[0])
    For $i = 0 To $iColumnCount-1
    ; get subitem text
    Local $iSubItmText = _GUICtrlListView_GetItemText($hListView, $itmID, $i)
    ; get subitem coordinates for drawing its respective text:
    Local $aSubItmRect = _GUICtrlListView_GetSubItemRect($hListView, $itmID, $i)
    ; the function above accepts not only subitems (one-based index), but also main item (index=0)
    ; pass the coordinates to a DLL struct
    Local $iSubItmRect = DllStructCreate("int Left;int Top;int Right;int Bottom")
    DllStructSetData($iSubItmRect, 1, $aSubItmRect[0] + $aRectMargins[0]) ; left margin
    DllStructSetData($iSubItmRect, 2, $aSubItmRect[1] + $aRectMargins[1]) ; upper margin
    DllStructSetData($iSubItmRect, 3, $aSubItmRect[2] + $aRectMargins[2]) ; right margin
    DllStructSetData($iSubItmRect, 4, $aSubItmRect[3] + $aRectMargins[3]) ; bottom margin
    Local $tRect = DllStructGetPtr($iSubItmRect)
    ; draw text
    DllCall("user32.dll", "int", "DrawText", "hwnd", $hDC, "str", $iSubItmText, "int", StringLen($iSubItmText), _
    "ptr", $tRect, "int", $aTextFormatting)
    Next
    Case $ODA_FOCUS
    ; The control has lost or gained the keyboard focus. The itemState member should be checked to determine whether the control has the focus.
    Case $ODA_SELECT
    ; The selection status has changed. The itemState member should be checked to determine the new selection state.
    EndSwitch
    ConsoleWrite(Round(TimerDiff($timer),2) & @TAB & "WM_DRAWITEM" & @CRLF)
    Return $GUI_RUNDEFMSG
    EndFunc

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

    Func _ListView_InsertControl($sHwnd, $iText, $sItemIndex, $sSubItemIndex = 0, $CtlType = Default)
    Local $oDict = ObjCreate("Scripting.Dictionary")
    Local $iX, $iY, $iWidth, $iHeight, $aRect
    If Not IsHWnd($sHwnd) Then $sHwnd = GUICtrlGetHandle($sHwnd)

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

    If $sSubItemIndex = 0 Then
    $aRect = _GUICtrlListView_GetItemRect($sHwnd, $sItemIndex, 2)
    Else
    $aRect = _GUICtrlListView_GetSubItemRect($sHwnd, $sItemIndex, $sSubItemIndex)
    EndIf

    Local $iX = $aRect[0] + 6, $iY = $aRect[1] + 2, $iWidth = ($aRect[2] - $aRect[0]) - 12, $iHeight = ($aRect[3] - $aRect[1]) - 4
    Switch $CtlType
    Case Default, "Edit"
    _GUICtrlListView_AddSubItem($sHwnd, $sItemIndex, "", $sSubItemIndex) ; place empty items behind the Edit controls
    Case "CheckBox"
    Local $iY = $aRect[1] + 6, $iWidth = 14, $iHeight = 14
    EndSwitch
    Local $hCtrl = _Ex_CreateCtrl($sHwnd, $iText, $CtlType, $iX, $iY, $iWidth, $iHeight)

    $oDict.add("hCtrl", $hCtrl)
    $oDict.add("sItemIndex", $sItemIndex)
    $oDict.add("sSubItemIndex", $sSubItemIndex)

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

    Return $oDict
    EndFunc ;==>_ListView_InsertEdit

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

    Func _Ex_CreateCtrl($hWnd, $iText, $CtlType, $iX, $iY, $iWidth = -1, $iHeight = -1, $iStyle = 0, $iExStyle = 0)
    Local $hCtrl
    Switch $CtlType
    Case Default, "Edit"
    $hCtrl = _GUICtrlEdit_Create($hWnd, $iText & $ids, $iX, $iY, $iWidth, $iHeight, BitOR($iStyle, $WS_TABSTOP, $WS_CHILD, $WS_VISIBLE, $ES_LEFT, $ES_AUTOHSCROLL, $ES_NOHIDESEL), BitOR($iExStyle, $WS_EX_CLIENTEDGE))
    $ids += 1
    Case "CheckBox"
    $hCtrl = _GUICtrlButton_Create($hWnd, $iText, $iX, $iY, $iWidth, $iHeight, BitOR($iStyle, $BS_AUTOCHECKBOX), $iExStyle)
    EndSwitch
    Return $hCtrl
    EndFunc ;==>_Edit_Create

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

    Func _MoveControl($hListView, $hCtrl, $sItemIndex, $sSubItemIndex)
    $hCtrl = HWnd($hCtrl) ; storing handles in dictionaries or lists fails, so this converts the expression into handles
    Local $ClassName = _WinAPI_GetClassName($hCtrl)
    Local $aRect
    ; if first colum have to be moved
    If $sSubItemIndex = 0 Then
    $aRect = _GUICtrlListView_GetItemRect($hListView, $sItemIndex, 2)
    Else
    $aRect = _GUICtrlListView_GetSubItemRect($hListView, $sItemIndex, $sSubItemIndex)
    EndIf

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

    If $aRect[1] < 10 Then
    _WinAPI_ShowWindow($hCtrl, $SW_HIDE) ; hide items out of view
    ElseIf $aRect[1] >= 10 Then
    _WinAPI_ShowWindow($hCtrl, $SW_SHOW) ; show items in view
    EndIf

    If $ClassName = "Edit" Then _WinAPI_MoveWindow($hCtrl, $aRect[0] + 6, $aRect[1] + 2, ($aRect[2] - $aRect[0]) - 12, ($aRect[3] - $aRect[1]) - 4, True)
    If $ClassName = "Button" Then _WinAPI_MoveWindow($hCtrl, $aRect[0] + 6, $aRect[1] + 6, 14, 14, True)
    EndFunc ;==>_MoveControl

    [/autoit]
  • ListView mit Checkboxen und Edit Controls V2

    • Trolleule1337
    • 19. Juli 2013 um 18:26

    Welche Funktion ist das?

    Zitat

    Kannst ja aber mal über die Rect probieren, ob das Item innerhalb deines Listview liegt.

  • ListView mit Checkboxen und Edit Controls V2

    • Trolleule1337
    • 19. Juli 2013 um 16:46

    Danke BugFix habs schon gelöst! Ja stimmt, sieht aber so übersichtlicher aus, ein Grund komplett auf Arrays zu verzichten...

    Bin gerade dabei das Ganze so umzuschreiben, dass es in eine Funktion eingesetzt werden kann, für mich ist es nur ein UnterProjekt welches ich in eine Main Funktionen packen will, d.h. manche Variablen werden dann nicht mehr erkannt, weil sie nicht mehr global sind.

    Ist es möglich das Handle vom ListViewControl im WM_DRAWITEM abzufragen?

  • ListView mit Checkboxen und Edit Controls V2

    • Trolleule1337
    • 19. Juli 2013 um 14:37

    So wie es aussieht kann das Dictionary keine handles speichern? Ich bekomme von der Funktion _Ex_CreateCtrl beispielsweise folgendes handle zurück: 0x007604AE.
    Wenn ich mir dann das Dictionary Item anschaue steht folgendes drin: 6424530

    Hat jemand ne Idee?

  • ListView mit Checkboxen und Edit Controls V2

    • Trolleule1337
    • 19. Juli 2013 um 13:54

    Ganz komisch, wenn ich im 2ten Beispiel in Zeile 248 mir $hCtrl ausgeben lasse ist ein hex Wert so wie es sein soll und wenn ich es nach $oDict.add("hCtrl", $hCtrl) nochmal ausgeben lasse ist es dezimal Wert. Jemand eine Idee was das soll? ?(

  • ListView mit Checkboxen und Edit Controls V2

    • Trolleule1337
    • 19. Juli 2013 um 01:03

    Hi Leute,
    habe meine alte viel zu überladene Version nochmal überarbeitet und was echt cooles erstellt. Sieht dann so aus:

    [autoit]

    #include <GuiConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GuiListView.au3>
    #include <WinAPI.au3>

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

    #include <Array.au3>
    #include <GDIPlus.au3>
    #include <GuiConstantsEx.au3>
    #include <GuiListView.au3>
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>
    #include <EditConstants.au3>
    #include <StaticConstants.au3>
    #include <GuiEdit.au3>
    #include <Constants.au3>
    #include <WinAPIEx.au3> ; from <a href='http://www.autoitscript.com/forum/topic/98712-winapiex-udf/' class='bbc_url' title=''>http://www.autoitscript.com/forum/topic/98712-winapiex-udf/</a>
    #include <GuiButton.au3>
    #include "ExListViewConstants.au3"
    Opt("GUIOnEventMode", 1)

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

    ; WM_MEASUREITEM allows setting the row height
    Global $lListView_row_height = 25
    GUIRegisterMsg($WM_MEASUREITEM, "WM_MEASUREITEM") ; place before listview creation - message sent once for each ownerdrawn control created

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

    Global $ids = 0
    Global $aProgress[1][4] ; stores handles of edit controls
    Global $aBox[1][4]

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

    $hGUI = GUICreate("ListView Set Item State", 700, 300)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Beenden")
    $btn = GUICtrlCreateButton("Move", 420, 2, 50, 25)
    GUICtrlSetOnEvent(-1, "MoveIt")
    $btn1 = GUICtrlCreateButton("SetHot", 480, 2, 50, 25)
    GUICtrlSetOnEvent(-1, "SetHot")
    $btn2 = GUICtrlCreateButton("GetLastRect", 530, 2, 50, 25)
    GUICtrlSetOnEvent(-1, "GetLastRect")
    $input = GUICtrlCreateEdit("sdaasd", 420, 100, 100, 50)
    $iStyle = BitOR($LVS_REPORT, $LVS_OWNERDRAWFIXED, $LVS_SHOWSELALWAYS, $LVS_SINGLESEL) ; style
    $iExStyle = $LVS_EX_FULLROWSELECT ; extended style
    $hListView = _GUICtrlListView_Create($hGUI, "Items|SubItems|SubItems", 2, 2, 394, 252, $iStyle, $iExStyle)

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

    ;~ _GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_FULLROWSELECT)

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

    For $i = 1 To 30
    _GUICtrlListView_AddItem($hListView, "") ; text of first column
    _GUICtrlListView_AddSubItem($hListView, $i-1, "SubItem " & $i-1, 1)
    _GUICtrlListView_AddSubItem($hListView, $i-1, "", 2)
    _ListView_InsertEdit($hListView, $i-1, 2)
    _ListView_InsertCheckbox($hListView, $i-1, 0)
    Next

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

    ;~ ConsoleWrite(_GUICtrlListView_GetTopIndex($hListView))

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

    $top = _SendMessage($hListView, $LVM_GETTOPINDEX)
    _GUICtrlListView_SetItemSelected($hListView, $top)
    _GUICtrlListView_SetItemFocused($hListView, $top) ; set focus

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

    ;~ _Arraydisplay($aBox)
    GUIRegisterMsg($WM_DRAWITEM, "WM_DRAWITEM")
    GUISetState()
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; place after GUISetState()

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

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

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

    Func MoveIt()
    Local $curitem = _GUICtrlListView_GetSelectedIndices($hListView)
    ConsoleWrite($curitem)
    _GUICtrlEdit_Destroy($aProgress[$curitem+1][0])
    EndFunc

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

    Func Beenden()
    Exit
    EndFunc

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

    Func SetHot()
    $top = _SendMessage($hListView, $LVM_GETTOPINDEX)
    _GUICtrlListView_SetItemSelected($hListView, $top)
    _GUICtrlListView_SetItemFocused($hListView, $top)

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

    EndFunc

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

    Func GetLastRect()
    GetRecItem($hListView, 29, 1)
    EndFunc

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

    Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
    Global $prevItem ; have to be global
    Local $firstItem, $lastItem
    Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    Local $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom")
    Local $nNotifyCode = DllStructGetData($tNMHDR, "Code")
    Local $hHeader = _GUICtrlListView_GetHeader($hListView)
    Switch $hWndFrom
    Case $hListView
    Switch $nNotifyCode
    Case $LVN_BEGINSCROLL
    ; Notifies a list-view control's parent window when a scrolling operation starts
    Case $LVN_ENDSCROLL
    ; Notifies a list-view control's parent window when a scrolling operation ends
    Local $items = _GUICtrlListView_GetCounterPage($hListView)
    ; change top and last item on scroll up
    If $prevItem > _SendMessage($hListView, $LVM_GETTOPINDEX) Then
    $firstItem = _SendMessage($hListView, $LVM_GETTOPINDEX)
    ; change top and last item on scroll down
    Else
    $firstItem = _SendMessage($hListView, $LVM_GETTOPINDEX) ; get index of top item
    $lastItem = $firstItem+$items
    EndIf
    $prevItem = $firstItem ; get previous top item
    ConsoleWrite("first: " & $firstItem &" last: " & $lastItem)
    For $i = $firstItem To $lastItem
    ConsoleWrite(" i: " &$i & @CRLF)
    _MoveControl($hListView, $aProgress[$i][0], $aProgress[$i][1], $aProgress[$i][2])
    _MoveControl($hListView, $aBox[$i][0], $aBox[$i][1], $aBox[$i][2])
    ;~ ConsoleWrite("itemmmm10: " & $aProgress[10][1])
    ; redraw text
    $sText = _GUICtrlEdit_GetText($aProgress[$i][0])
    _GUICtrlEdit_SetText($aProgress[$i][0], $sText)
    ;~ If Not $firstItem Then Return ConsoleWrite("hier")
    Next
    _GUICtrlListView_SetItemSelected($hListView, $firstItem) ; set selection
    _GUICtrlListView_SetItemFocused($hListView, $firstItem) ; set focus
    EndSwitch
    Case $hHeader
    Switch $nNotifyCode
    Case $HDN_ITEMCHANGEDW
    ; Notifies a header control's parent window that the attributes of a header item have changed
    Local $items = _GUICtrlListView_GetCounterPage($hListView)
    Local $firstItem = _SendMessage($hListView, $LVM_GETTOPINDEX) ; get index of top item
    Local $lastItem = $firstItem+$items
    For $i = $firstItem To $lastItem
    _MoveControl($hListView, $aProgress[$i][0], $aProgress[$i][1], $aProgress[$i][2])
    Next
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIFY

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

    Func WM_MEASUREITEM($hWnd, $Msg, $wParam, $lParam)
    Local $tMEASUREITEMS = DllStructCreate("uint cType;uint cID;uint itmID;uint itmW;uint itmH;ulong_ptr itmData", $lParam)
    If DllStructGetData($tMEASUREITEMS, "cType") <> $ODT_LISTVIEW Then Return $GUI_RUNDEFMSG
    DllStructSetData($tMEASUREITEMS, "itmH", $lListView_row_height) ; row height
    Return 1
    EndFunc ;==>WM_MEASUREITEM

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

    Func WM_DRAWITEM($hWnd, $Msg, $wParam, $lParam)
    Local $iColumnCount = _GUICtrlListView_GetColumnCount($hListView)
    Local $aTextFormatting = BitOR($DT_VCENTER, $DT_SINGLELINE, $DT_CENTER, $DT_END_ELLIPSIS)
    Local $aRectMargins[4] = [6, -1, -4, 0]
    Local $tagDRAWITEMSTRUCT, $iBrushColor, $cID, $itmID, $itmAction, $itmState, $hItm, $hDC, $bSelected
    $timer = TimerInit()
    $tagDRAWITEMSTRUCT = DllStructCreate("uint cType;uint cID;uint itmID;uint itmAction;uint itmState;" & _
    "hwnd hItm;hwnd hDC;int itmRect[4];dword itmData", $lParam)
    If DllStructGetData($tagDRAWITEMSTRUCT, "cType") <> $ODT_LISTVIEW Then Return $GUI_RUNDEFMSG
    $cID = DllStructGetData($tagDRAWITEMSTRUCT, "cID")
    $itmID = DllStructGetData($tagDRAWITEMSTRUCT, "itmID")
    $itmAction = DllStructGetData($tagDRAWITEMSTRUCT, "itmAction")
    $itmState = DllStructGetData($tagDRAWITEMSTRUCT, "itmState")
    $hItm = DllStructGetData($tagDRAWITEMSTRUCT, "hItm")
    $hDC = DllStructGetData($tagDRAWITEMSTRUCT, "hDC")
    $bSelected = BitAND($itmState, $ODS_SELECTED)
    $bfocusSelected = BitOR($ODS_FOCUS, $ODS_SELECTED)
    Switch $itmAction
    Case $ODA_DRAWENTIRE
    ; change color of selected items
    Switch $itmState
    Case $ODS_SELECTED
    ; The menu item's status is selected
    Case $ODS_GRAYED
    ; The item is to be grayed. This bit is used only in a menu
    Case $ODS_DISABLED
    ; The item is to be drawn as disabled
    Case $ODS_CHECKED
    ; The menu item is to be checked. This bit is used only in a menu
    Case $ODS_FOCUS, $bSelected
    ; The item has the keyboard focus
    $iBrushColor = 0xFFFFFF
    Case $ODS_DEFAULT
    ; The item is the default item
    Case $ODS_COMBOBOXEDIT
    ; The drawing takes place in the selection field (edit control) of an owner-drawn combo box
    Case $bfocusSelected
    ; The menu item's status is selected and has keyboard focus
    $iBrushColor = 0xEEDDBB
    EndSwitch
    ; create a brush with the desired color
    Local $aBrush = DLLCall("gdi32.dll","hwnd","CreateSolidBrush", "int", $iBrushColor)
    ; get the rectangle for the whole row and fill it
    Local $iLeft = DllStructGetData($tagDRAWITEMSTRUCT, "itmRect", 1)
    DllStructSetData($tagDRAWITEMSTRUCT, "itmRect", $iLeft + 5, 1)
    _WinAPI_FillRect($hDC, DllStructGetPtr($tagDRAWITEMSTRUCT, "itmRect"), $aBrush[0])
    For $i = 0 To $iColumnCount-1
    ; get subitem text
    Local $iSubItmText = _GUICtrlListView_GetItemText($hListView, $itmID, $i)
    ; get subitem coordinates for drawing its respective text:
    Local $aSubItmRect = _GUICtrlListView_GetSubItemRect($hListView, $itmID, $i)
    ; the function above accepts not only subitems (one-based index), but also main item (index=0)
    ; pass the coordinates to a DLL struct
    Local $iSubItmRect = DllStructCreate("int Left;int Top;int Right;int Bottom")
    DllStructSetData($iSubItmRect, 1, $aSubItmRect[0] + $aRectMargins[0]) ; left margin
    DllStructSetData($iSubItmRect, 2, $aSubItmRect[1] + $aRectMargins[1]) ; upper margin
    DllStructSetData($iSubItmRect, 3, $aSubItmRect[2] + $aRectMargins[2]) ; right margin
    DllStructSetData($iSubItmRect, 4, $aSubItmRect[3] + $aRectMargins[3]) ; bottom margin
    Local $tRect = DllStructGetPtr($iSubItmRect)
    ; draw text
    DllCall("user32.dll", "int", "DrawText", "hwnd", $hDC, "str", $iSubItmText, "int", StringLen($iSubItmText), _
    "ptr", $tRect, "int", $aTextFormatting)
    Next
    Case $ODA_FOCUS
    ; The control has lost or gained the keyboard focus. The itemState member should be checked to determine whether the control has the focus.
    Case $ODA_SELECT
    ; The selection status has changed. The itemState member should be checked to determine the new selection state.
    EndSwitch
    ;~ ConsoleWrite(Round(TimerDiff($timer),2) & @TAB & "WM_DRAWITEM" & @CRLF)
    Return $GUI_RUNDEFMSG
    EndFunc





    Func _ListView_InsertEdit($sHwnd, $sItemIndex, $sSubItemIndex = 0)
    If Not IsHWnd($sHwnd) Then $sHwnd = GUICtrlGetHandle($sHwnd)
    ;~ Local $iStyle = _WinAPI_GetWindowLong($sHwnd, $GWL_STYLE)
    ;~ If BitAND($iStyle, $WS_CLIPCHILDREN) <> $WS_CLIPCHILDREN Then
    ;~ _WinAPI_SetWindowLong($sHwnd, $GWL_STYLE, BitOR($iStyle, $WS_CLIPCHILDREN))
    ;~ EndIf
    Local $aRect
    If $sSubItemIndex = 0 Then
    $aRect = _GUICtrlListView_GetItemRect($sHwnd, $sItemIndex, 2)
    Else
    $aRect = _GUICtrlListView_GetSubItemRect($sHwnd, $sItemIndex, $sSubItemIndex)
    EndIf

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

    $aProgress[0][0] += 1
    ReDim $aProgress[$aProgress[0][0]+1][4]
    $aProgress[$aProgress[0][0]][0] = _Edit_Create($sHwnd, $aRect[0] + 6, $aRect[1] + 2, ($aRect[2] - $aRect[0]) - 12, ($aRect[3] - $aRect[1]) - 4)

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

    $aProgress[$aProgress[0][0]][1] = $sItemIndex
    $aProgress[$aProgress[0][0]][2] = $sSubItemIndex
    $aProgress[$aProgress[0][0]][3] = $sHwnd

    Return $aProgress[$aProgress[0][0]][0]
    EndFunc ;==>_ListView_InsertEdit

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

    Func _Edit_Create($hWnd, $iX, $iY, $iWidth = -1, $iHeight = -1, $iStyle = 0, $iExStyle = 0x00000200)

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

    $iStyle = BitOR($iStyle, $WS_TABSTOP, $WS_CHILD, $WS_VISIBLE, $ES_LEFT, $ES_AUTOHSCROLL, $ES_NOHIDESEL)
    ;~ Local $hEdit = _WinAPI_CreateWindowEx($iExStyle, "EDIT", "", $iStyle, $iX, $iY, $iWidth, $iHeight, $hWnd, $ids)
    ;~ _SendMessage($hEdit, $__EDITCONSTANT_WM_SETFONT, _WinAPI_GetStockObject($__EDITCONSTANT_DEFAULT_GUI_FONT), True) ; set font style
    Local $hEdit = _GUICtrlEdit_Create($hWnd, "", $iX, $iY, $iWidth, $iHeight, $iStyle, $iExStyle)
    ; testen
    ;~ _GUICtrlEdit_SetLimitText($hEdit, 0)

    _GUICtrlEdit_SetText($hEdit, "test"&$ids)
    ;~ _GUICtrlEdit_SetReadOnly($hEdit, True)
    $ids += 1
    ;~ _WinAPI_ShowWindow($hEdit, $SW_HIDE)
    Return $hEdit
    EndFunc ;==>_Edit_Create

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

    Func GetRecItem($hListView, $sItemIndex, $sSubItemIndex)
    ConsoleWrite("Item: " & $sItemIndex & " SubItem: " & $sSubItemIndex & @CRLF)
    $aRect = _GUICtrlListView_GetSubItemRect($hListView, $sItemIndex, $sSubItemIndex)
    ConsoleWrite("xleft: " & $aRect[0] & " yleft: " & $aRect[1] & "xright: " & $aRect[2] & " yright: " & $aRect[3] & @CRLF)
    ;~ $label = GUICtrlCreateLabel("Hier", $aRect[0], $aRect[1], 20, 18)
    EndFunc

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

    Func _MoveControl($hListView, $hCtrl, $sItemIndex, $sSubItemIndex)
    Local $ClassName = _WinAPI_GetClassName($hCtrl)
    Local $aRect

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

    If $sSubItemIndex = 0 Then
    $aRect = _GUICtrlListView_GetItemRect($hListView, $sItemIndex, 2)
    Else
    $aRect = _GUICtrlListView_GetSubItemRect($hListView, $sItemIndex, $sSubItemIndex)
    EndIf
    ConsoleWrite("item: " & $sItemIndex & " xleft: " & $aRect[0] & " yleft: " & $aRect[1] & "xright: " & $aRect[2] & " yright: " & $aRect[3] & @CRLF)
    If $aRect[1] < 10 Then
    _WinAPI_ShowWindow($hCtrl, $SW_HIDE)
    ElseIf $aRect[1] >= 10 Then
    _WinAPI_ShowWindow($hCtrl, $SW_SHOW)
    EndIf

    If $ClassName = "Edit" Then _WinAPI_MoveWindow($hCtrl, $aRect[0] + 6, $aRect[1] + 2, ($aRect[2] - $aRect[0]) - 12, ($aRect[3] - $aRect[1]) - 4, True)
    If $ClassName = "Button" Then _WinAPI_MoveWindow($hCtrl, $aRect[0] + 6, $aRect[1] + 6, 14, 14, True)
    EndFunc ;==>_MoveControl

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

    Func _CheckBox_Create($hWnd, $iX, $iY, $iWidth = -1, $iHeight = -1, $iStyle = 0, $iExStyle = -1)
    $iStyle = BitOR($iStyle, $BS_AUTOCHECKBOX)
    Local $hBtn = _GUICtrlButton_Create($hWnd, "", $iX, $iY, $iWidth, $iHeight, $iStyle, $iExStyle)
    Return $hBtn
    EndFunc ;==>_CheckBox_Create

    Func _ListView_InsertCheckbox($sHwnd, $sItemIndex, $sSubItemIndex = 0)
    If Not IsHWnd($sHwnd) Then $sHwnd = GUICtrlGetHandle($sHwnd)
    ;~ Local $iStyle = _WinAPI_GetWindowLong($sHwnd, $GWL_STYLE)
    ;~ If BitAND($iStyle, $WS_CLIPCHILDREN) <> $WS_CLIPCHILDREN Then
    ;~ _WinAPI_SetWindowLong($sHwnd, $GWL_STYLE, BitOR($iStyle, $WS_CLIPCHILDREN))
    ;~ EndIf
    Local $aRect
    If $sSubItemIndex = 0 Then
    $aRect = _GUICtrlListView_GetItemRect($sHwnd, $sItemIndex, 2)
    Else
    $aRect = _GUICtrlListView_GetSubItemRect($sHwnd, $sItemIndex, $sSubItemIndex)
    EndIf

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

    $aBox[0][0] += 1
    ReDim $aBox[$aBox[0][0]+1][4]
    $aBox[$aBox[0][0]][0] = _CheckBox_Create($sHwnd, $aRect[0] + 6, $aRect[1] + 6, 14, 14)

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

    $aBox[$aBox[0][0]][1] = $sItemIndex
    $aBox[$aBox[0][0]][2] = $sSubItemIndex
    $aBox[$aBox[0][0]][3] = $sHwnd

    Return $aBox[$aBox[0][0]][0]
    EndFunc

    [/autoit]


    Sooo das obere läuft allerdings noch mit Arrays, was zwar super funktioniert, mir persönlich aber nicht gefällt, das geht noch besser. Habe das Ganze jetzt nochmal mit Listen von Dictionarys umgebaut:

    [autoit]

    #include <GuiConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GuiListView.au3>
    #include <WinAPI.au3>
    #include <Array.au3>
    #include <GuiConstantsEx.au3>
    #include <GuiListView.au3>
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>
    #include <EditConstants.au3>
    #include <StaticConstants.au3>
    #include <GuiEdit.au3>
    #include <Constants.au3>
    #include <WinAPIEx.au3> ; from <a href='http://www.autoitscript.com/forum/topic/98712-winapiex-udf/' class='bbc_url' title=''>http://www.autoitscript.com/forum/topic/98712-winapiex-udf/</a>
    #include "ExListViewConstants.au3"
    #include <GuiButton.au3>
    Opt("GUIOnEventMode", 1)

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

    ; WM_MEASUREITEM allows setting the row height
    Global $lListView_row_height = 25
    GUIRegisterMsg($WM_MEASUREITEM, "WM_MEASUREITEM") ; place before listview creation - message sent once for each ownerdrawn control created

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

    Global $ids = 0

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

    $hGUI = GUICreate("ListView Set Item State", 700, 300)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Beenden")
    $btn = GUICtrlCreateButton("Move", 420, 2, 50, 25)
    GUICtrlSetOnEvent(-1, "MoveIt")
    $btn1 = GUICtrlCreateButton("SetHot", 480, 2, 50, 25)
    GUICtrlSetOnEvent(-1, "SetHot")
    $btn2 = GUICtrlCreateButton("GetLastRect", 530, 2, 50, 25)
    GUICtrlSetOnEvent(-1, "GetLastRect")
    $input = GUICtrlCreateEdit("sdaasd", 420, 100, 100, 50)
    $iStyle = BitOR($LVS_REPORT, $LVS_OWNERDRAWFIXED, $LVS_SHOWSELALWAYS, $LVS_SINGLESEL) ; style
    $iExStyle = $LVS_EX_FULLROWSELECT ; extended style
    $hListView = _GUICtrlListView_Create($hGUI, "Items|SubItems|SubItems", 2, 2, 394, 252, $iStyle, $iExStyle)
    Global $items = _GUICtrlListView_GetCounterPage($hListView)

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

    Local $EditList = ObjCreate("System.Collections.ArrayList")
    Local $BoxList = ObjCreate("System.Collections.ArrayList")

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

    For $i = 1 To 30
    _GUICtrlListView_AddItem($hListView, "") ; text of first column
    _GUICtrlListView_AddSubItem($hListView, $i-1, "SubItem " & $i-1, 1)
    _GUICtrlListView_AddSubItem($hListView, $i-1, "", 2)
    $EditList.add(_ListView_InsertControl($hListView, "", $i-1, 2, "Edit"))
    $BoxList.add(_ListView_InsertControl($hListView, "", $i-1, 0, "CheckBox"))
    Next

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

    $top = _SendMessage($hListView, $LVM_GETTOPINDEX) ; get top item
    _GUICtrlListView_SetItemSelected($hListView, $top) ; select top item
    _GUICtrlListView_SetItemFocused($hListView, $top) ; focus top item

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

    ;~ _Arraydisplay($aBox)
    GUIRegisterMsg($WM_DRAWITEM, "WM_DRAWITEM")
    GUISetState()
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; place after GUISetState()

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

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

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

    Func MoveIt()
    Local $curitem = _GUICtrlListView_GetSelectedIndices($hListView)
    ConsoleWrite($curitem)
    _GUICtrlEdit_Destroy($aProgress[$curitem+1][0])
    EndFunc

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

    Func Beenden()
    Exit
    EndFunc

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

    Func SetHot()
    $top = _SendMessage($hListView, $LVM_GETTOPINDEX)
    _GUICtrlListView_SetItemSelected($hListView, $top)
    _GUICtrlListView_SetItemFocused($hListView, $top)

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

    EndFunc

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

    Func GetRecItem($hListView, $sItemIndex, $sSubItemIndex)
    ConsoleWrite("Item: " & $sItemIndex & " SubItem: " & $sSubItemIndex & @CRLF)
    $aRect = _GUICtrlListView_GetSubItemRect($hListView, $sItemIndex, $sSubItemIndex)
    ConsoleWrite("xleft: " & $aRect[0] & " yleft: " & $aRect[1] & "xright: " & $aRect[2] & " yright: " & $aRect[3] & @CRLF)
    ;~ $label = GUICtrlCreateLabel("Hier", $aRect[0], $aRect[1], 20, 18)
    EndFunc

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

    Func GetLastRect()
    GetRecItem($hListView, 29, 1)
    EndFunc

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

    Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
    Global $prevItem ; have to be global
    Global $firstItem, $lastItem ; have to be global
    Global $lEdit, $lBox
    Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    Local $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom")
    Local $nNotifyCode = DllStructGetData($tNMHDR, "Code")
    Local $hHeader = _GUICtrlListView_GetHeader($hListView)
    Switch $hWndFrom
    Case $hListView
    Switch $nNotifyCode
    Case $LVN_BEGINSCROLL
    ; Notifies a list-view control's parent window when a scrolling operation starts
    Case $LVN_ENDSCROLL
    ; Notifies a list-view control's parent window when a scrolling operation ends
    ; change top and last item on scroll up
    If $prevItem > _SendMessage($hListView, $LVM_GETTOPINDEX) Then
    $firstItem = _SendMessage($hListView, $LVM_GETTOPINDEX)
    ; change top and last item on scroll down
    Else
    $firstItem = _SendMessage($hListView, $LVM_GETTOPINDEX) ; get index of top item
    $lastItem = $firstItem+$items
    EndIf
    $prevItem = $firstItem ; get previous top item
    ConsoleWrite("first: " & $firstItem &" last: " & $lastItem)
    For $i = $firstItem To $lastItem
    ConsoleWrite(" i: " &$i & @CRLF)
    If $i = 0 Then ContinueLoop
    $lEdit = $EditList.Item($i-1)
    $lBox = $BoxList.Item($i-1)

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

    ;~ ConsoleWrite("sItemIndex: " & $lEdit.Item("sItemIndex") &" last: " & $lastItem & @CRLF)
    _MoveControl($hListView, $lEdit.Item("hCtrl"), $lEdit.Item("sItemIndex"), $lEdit.Item("sSubItemIndex"))
    _MoveControl($hListView, $lBox.Item("hCtrl"), $lBox.Item("sItemIndex"), $lBox.Item("sSubItemIndex"))
    ; redraw text
    $sText = _GUICtrlEdit_GetText($lEdit.Item("hCtrl"))
    _GUICtrlEdit_SetText($lEdit.Item("hCtrl"), $sText)
    Next
    _GUICtrlListView_SetItemSelected($hListView, $firstItem) ; set selection
    _GUICtrlListView_SetItemFocused($hListView, $firstItem) ; set focus
    EndSwitch
    Case $hHeader
    Switch $nNotifyCode
    Case $HDN_ITEMCHANGEDW
    ; Notifies a header control's parent window that the attributes of a header item have changed
    Local $fItem = _SendMessage($hListView, $LVM_GETTOPINDEX) ; get index of top item
    Local $lItem = $firstItem+$items
    For $i = $fItem To $lItem
    $lEdit = $EditList.Item($i)
    _MoveControl($hListView, $lEdit.Item("hCtrl"), $lEdit.Item("sItemIndex"), $lEdit.Item("sSubItemIndex"))
    Next
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIFY

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

    Func WM_MEASUREITEM($hWnd, $Msg, $wParam, $lParam)
    Local $tMEASUREITEMS = DllStructCreate("uint cType;uint cID;uint itmID;uint itmW;uint itmH;ulong_ptr itmData", $lParam)
    If DllStructGetData($tMEASUREITEMS, "cType") <> $ODT_LISTVIEW Then Return $GUI_RUNDEFMSG
    DllStructSetData($tMEASUREITEMS, "itmH", $lListView_row_height) ; row height
    Return 1
    EndFunc ;==>WM_MEASUREITEM

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

    Func WM_DRAWITEM($hWnd, $Msg, $wParam, $lParam)
    Local $iColumnCount = _GUICtrlListView_GetColumnCount($hListView)
    Local $aTextFormatting = BitOR($DT_VCENTER, $DT_SINGLELINE, $DT_CENTER, $DT_END_ELLIPSIS)
    Local $aRectMargins[4] = [6, -1, -4, 0]
    Local $tagDRAWITEMSTRUCT, $iBrushColor, $cID, $itmID, $itmAction, $itmState, $hItm, $hDC, $bSelected
    $timer = TimerInit()
    $tagDRAWITEMSTRUCT = DllStructCreate("uint cType;uint cID;uint itmID;uint itmAction;uint itmState;" & _
    "hwnd hItm;hwnd hDC;int itmRect[4];dword itmData", $lParam)
    If DllStructGetData($tagDRAWITEMSTRUCT, "cType") <> $ODT_LISTVIEW Then Return $GUI_RUNDEFMSG
    $cID = DllStructGetData($tagDRAWITEMSTRUCT, "cID")
    $itmID = DllStructGetData($tagDRAWITEMSTRUCT, "itmID")
    $itmAction = DllStructGetData($tagDRAWITEMSTRUCT, "itmAction")
    $itmState = DllStructGetData($tagDRAWITEMSTRUCT, "itmState")
    $hItm = DllStructGetData($tagDRAWITEMSTRUCT, "hItm")
    $hDC = DllStructGetData($tagDRAWITEMSTRUCT, "hDC")
    $bSelected = BitAND($itmState, $ODS_SELECTED)
    $bfocusSelected = BitOR($ODS_FOCUS, $ODS_SELECTED)
    Switch $itmAction
    Case $ODA_DRAWENTIRE
    ; change color of selected items
    Switch $itmState
    Case $ODS_SELECTED
    ; The menu item's status is selected
    Case $ODS_GRAYED
    ; The item is to be grayed. This bit is used only in a menu
    Case $ODS_DISABLED
    ; The item is to be drawn as disabled
    Case $ODS_CHECKED
    ; The menu item is to be checked. This bit is used only in a menu
    Case $ODS_FOCUS, $bSelected
    ; The item has the keyboard focus
    $iBrushColor = 0xFFFFFF
    Case $ODS_DEFAULT
    ; The item is the default item
    Case $ODS_COMBOBOXEDIT
    ; The drawing takes place in the selection field (edit control) of an owner-drawn combo box
    Case $bfocusSelected
    ; The menu item's status is selected and has keyboard focus
    $iBrushColor = 0xEEDDBB
    EndSwitch
    ; create a brush with the desired color
    Local $aBrush = DLLCall("gdi32.dll","hwnd","CreateSolidBrush", "int", $iBrushColor)
    ; get the rectangle for the whole row and fill it
    Local $iLeft = DllStructGetData($tagDRAWITEMSTRUCT, "itmRect", 1)
    DllStructSetData($tagDRAWITEMSTRUCT, "itmRect", $iLeft + 5, 1)
    _WinAPI_FillRect($hDC, DllStructGetPtr($tagDRAWITEMSTRUCT, "itmRect"), $aBrush[0])
    For $i = 0 To $iColumnCount-1
    ; get subitem text
    Local $iSubItmText = _GUICtrlListView_GetItemText($hListView, $itmID, $i)
    ; get subitem coordinates for drawing its respective text:
    Local $aSubItmRect = _GUICtrlListView_GetSubItemRect($hListView, $itmID, $i)
    ; the function above accepts not only subitems (one-based index), but also main item (index=0)
    ; pass the coordinates to a DLL struct
    Local $iSubItmRect = DllStructCreate("int Left;int Top;int Right;int Bottom")
    DllStructSetData($iSubItmRect, 1, $aSubItmRect[0] + $aRectMargins[0]) ; left margin
    DllStructSetData($iSubItmRect, 2, $aSubItmRect[1] + $aRectMargins[1]) ; upper margin
    DllStructSetData($iSubItmRect, 3, $aSubItmRect[2] + $aRectMargins[2]) ; right margin
    DllStructSetData($iSubItmRect, 4, $aSubItmRect[3] + $aRectMargins[3]) ; bottom margin
    Local $tRect = DllStructGetPtr($iSubItmRect)
    ; draw text
    DllCall("user32.dll", "int", "DrawText", "hwnd", $hDC, "str", $iSubItmText, "int", StringLen($iSubItmText), _
    "ptr", $tRect, "int", $aTextFormatting)
    Next
    Case $ODA_FOCUS
    ; The control has lost or gained the keyboard focus. The itemState member should be checked to determine whether the control has the focus.
    Case $ODA_SELECT
    ; The selection status has changed. The itemState member should be checked to determine the new selection state.
    EndSwitch
    ;~ ConsoleWrite(Round(TimerDiff($timer),2) & @TAB & "WM_DRAWITEM" & @CRLF)
    Return $GUI_RUNDEFMSG
    EndFunc

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

    Func _ListView_InsertControl($sHwnd, $iText, $sItemIndex, $sSubItemIndex = 0, $CtlType = Default)
    Local $oDict = ObjCreate("Scripting.Dictionary")
    Local $iX, $iY, $iWidth, $iHeight, $aRect
    If Not IsHWnd($sHwnd) Then $sHwnd = GUICtrlGetHandle($sHwnd)

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

    If $sSubItemIndex = 0 Then
    $aRect = _GUICtrlListView_GetItemRect($sHwnd, $sItemIndex, 2)
    Else
    $aRect = _GUICtrlListView_GetSubItemRect($sHwnd, $sItemIndex, $sSubItemIndex)
    EndIf

    Local $iX = $aRect[0] + 6, $iY = $aRect[1] + 2, $iWidth = ($aRect[2] - $aRect[0]) - 12, $iHeight = ($aRect[3] - $aRect[1]) - 4
    If $CtlType = "CheckBox" Then Local $iY = $aRect[1] + 6, $iWidth = 14, $iHeight = 14

    Local $hCtrl = _Ex_CreateCtrl($sHwnd, $iText, $CtlType, $iX, $iY, $iWidth, $iHeight)

    $oDict.add("hCtrl", $hCtrl)
    $oDict.add("sItemIndex", $sItemIndex)
    $oDict.add("sSubItemIndex", $sSubItemIndex)

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

    Return $oDict
    EndFunc ;==>_ListView_InsertEdit

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

    Func _Ex_CreateCtrl($hWnd, $iText, $CtlType, $iX, $iY, $iWidth = -1, $iHeight = -1, $iStyle = 0, $iExStyle = 0)
    Local $hCtrl

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

    Switch $CtlType
    Case Default, "Edit"
    ;~ ConsoleWrite("xleft: " & $iX & " yleft: " & $iY & "xright: " & $iWidth & " yright: " & $iHeight & @CRLF)
    ;~ ConsoleWrite(
    $hCtrl = _GUICtrlEdit_Create($hWnd, $iText & $ids, $iX, $iY, $iWidth, $iHeight, BitOR($iStyle, $WS_TABSTOP, $WS_CHILD, $WS_VISIBLE, $ES_LEFT, $ES_AUTOHSCROLL, $ES_NOHIDESEL), BitOR($iExStyle, $WS_EX_CLIENTEDGE))
    $ids += 1
    Case "CheckBox"
    ;~ ConsoleWrite("hier")
    ;~ ConsoleWrite("xleft: " & $iX & " yleft: " & $iY & "xright: " & $iWidth & " yright: " & $iHeight & @CRLF)
    $hCtrl = _GUICtrlButton_Create($hWnd, $iText, $iX, $iY, $iWidth, $iHeight, BitOR($iStyle, $BS_AUTOCHECKBOX), $iExStyle)
    EndSwitch

    Return $hCtrl
    EndFunc ;==>_Edit_Create

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

    Func _MoveControl($hListView, $hCtrl, $sItemIndex, $sSubItemIndex)
    Local $ClassName = _WinAPI_GetClassName($hCtrl)
    Local $aRect

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

    If $sSubItemIndex = 0 Then
    $aRect = _GUICtrlListView_GetItemRect($hListView, $sItemIndex, 2)
    Else
    $aRect = _GUICtrlListView_GetSubItemRect($hListView, $sItemIndex, $sSubItemIndex)
    EndIf
    ConsoleWrite("item: " & $sItemIndex & " xleft: " & $aRect[0] & " yleft: " & $aRect[1] & "xright: " & $aRect[2] & " yright: " & $aRect[3] & @CRLF)
    If $aRect[1] < 10 Then
    _WinAPI_ShowWindow($hCtrl, $SW_HIDE)
    ElseIf $aRect[1] >= 10 Then
    _WinAPI_ShowWindow($hCtrl, $SW_SHOW)
    EndIf

    If $ClassName = "Edit" Then _WinAPI_MoveWindow($hCtrl, $aRect[0] + 6, $aRect[1] + 2, ($aRect[2] - $aRect[0]) - 12, ($aRect[3] - $aRect[1]) - 4, True)
    If $ClassName = "Button" Then _WinAPI_MoveWindow($hCtrl, $aRect[0] + 6, $aRect[1] + 6, 14, 14, True)
    EndFunc ;==>_MoveControl

    [/autoit]


    Da ist irgendwas nicht richtig, kann aber das Problem nicht ausfindig machen. Die Darstellung ist total daneben und die Checkboxen werden zum Teil gar nicht mehr angezeigt, wenn gescrollt wird. Die Header width vergrößern funktioniert nun gar nicht mehr ?(

    Habe das ganze Projekt mal angehangen, so kann man es sofort benutzen

    Kann da jemand mal bitte mit drüber schauen?

    Gruß Andi

    Dateien

    ExListView.rar 204,35 kB – 413 Downloads
  • ListView mit Checkboxen und Edit Controls

    • Trolleule1337
    • 2. Juli 2013 um 22:53

    Hab den Code aktualisiert: Ich kann jetzt zwar scrollen, aber nur durch klicken auf die pfeile, beim schnellen scrollen kommt er mit der richtigen Anzeige nicht mehr mit, also die Reihenfolge der Edits stimmt nicht mehr. Mir ist auch aufgefallen, das nur beim einfachen Mouse Hover über die Edit Controls, DrawItem ausgelöst wird, warum ist das so? Und das schreiben in den Edit Controls führt zum Absturz je nachdem wie ungeschickt man danach ins Listview Control klickt. Hat jemand ne idee?

  • ListView mit Checkboxen und Edit Controls

    • Trolleule1337
    • 2. Juli 2013 um 03:16

    Hey grüßt euch,
    ich möchte eine Art extended Listview mit Checkboxen und Edit Controls bauen. Ich bin soweit, dass ich die Controls integriert habe, allerdings werden die Edit Controls nicht wie die Checkboxen gezeichnet werden sondern mit _WinAPI_CreateWindowEx erstellt werden. Dementsprechend werden die Edits beim scrollen nicht neu gezeichnet und so bleiben die Edits immer On Top, also verschwinden nicht beim Scrollen. Hat jemand eine Idee wie ich das lösen kann?

    [autoit]

    #include <Array.au3>
    #include <GDIPlus.au3>
    #include <GuiConstantsEx.au3>
    #include <GuiListView.au3>
    #include <GuiImageList.au3>
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>
    #include <EditConstants.au3>
    #include <StaticConstants.au3>
    #include <GuiEdit.au3>
    #include <Constants.au3>
    #include <WinAPIEx.au3> ; from <a href='http://www.autoitscript.com/forum/topic/98712-winapiex-udf/' class='bbc_url' title=''>http://www.autoitscript.com/forum/topic/98712-winapiex-udf/</a>

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

    Global $aProgress[1][4] ; stores handles of edit controls
    Global Const $ODT_LISTVIEW = 102
    Global Const $ODA_DRAWENTIRE = 0x1
    Global Const $SW_HIDE = 0
    Global Const $SW_SHOW = 5
    ; ####################################
    ; adjustment of the icon positioning, according to windows version
    Global $iAdjustV = 0
    If $__WINVER > 0x0600 Then $iAdjustV = 1 ; $__WINVER defined in WinAPIEx, $__WINVER > 0x0600 means Vista+
    ; ####################################

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

    ; WM_MEASUREITEM allows setting the row height
    Global $iListView_row_height, $hIml_Listview, $hListView
    GUIRegisterMsg($WM_MEASUREITEM, "WM_MEASUREITEM") ; place before listview creation - message sent once for each ownerdrawn control created
    Global $ids = 101

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

    $hGUI = GUICreate("ListView Set Item State", 700, 300)
    $cButton_CheckAll = GUICtrlCreateButton("Check All", 10, 275, 100, 20)
    $cButton_UncheckAll = GUICtrlCreateButton("UnCheck All", 120, 275, 100, 20)
    $cButton_StatesToArray = GUICtrlCreateButton("States to Array", 230, 275, 100, 20)

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

    $iListView_row_height = 25
    $checkbox_column = 2
    $edit_column = 3
    _GDIPlus_Startup()
    $cListView = _GUICtrlCreateListViewEx("", 2, 2, 394, 268)

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

    ; Add columns
    _GUICtrlListView_AddColumn($hListView, " ", 0)
    For $i = 1 To 3
    _GUICtrlListView_AddColumn($hListView, "Column " & $i, 100)
    Next
    Local $aItems[30][4]
    For $row = 0 To 29
    $aItems[$row][0] = "this won't show up"
    $aItems[$row][1] = ""
    $aItems[$row][2] = "Row " & $row & ": Col 2"
    ;~ $aItems[$row][3] = "Row " & $row & ": Col 3"
    ; _ListView_InsertEdit($hListView, $row, $edit_column)
    Next

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

    ; only for testing
    For $row = 0 To 29
    _ListView_InsertEdit($hListView, $row, $edit_column)
    Next

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

    _GUICtrlListView_DeleteAllItems($hListView)
    __GUI_ListView_Add_Array($hListView, $aItems) ; workaround
    ; -----------------------------------------------------------

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

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
    GUIRegisterMsg($WM_DRAWITEM, "WM_DRAWITEM")
    GUISetState()

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

    ; Loop until user exits
    While 1
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    ExitLoop
    Case $cButton_CheckAll
    _LV_ImgCheckboxes_CheckAll($hListView)
    Case $cButton_UncheckAll
    _LV_ImgCheckboxes_UncheckAll($hListView)
    Case $cButton_StatesToArray
    $aLVStates = _LV_ImgCheckboxes_StatesToArray($hListView)
    _ArrayDisplay($aLVStates)
    EndSwitch
    WEnd
    GUIDelete()
    _GUIImageList_Destroy($hIml_Listview)
    _GDIPlus_Shutdown()
    Exit

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

    Func __GUI_ListView_Add_Array($hListView, ByRef $array)
    If Not IsArray($array) Then Return SetError(1, 0, 0) ; not an array
    Local $iColumnCount = _GUICtrlListView_GetColumnCount($hListView)
    ; if the number of columns between the array and the listview doesn't match:
    If UBound($array,2) <> $iColumnCount Then Return SetError(3, 1, 0)
    Switch UBound($array, 0)
    Case 1 ; 1-dimensioned array
    _GUICtrlListView_BeginUpdate($hListView)
    For $r = 0 To UBound($array, 1) - 1
    _GUICtrlListView_AddItem($hListView, $array[$r], 0)
    Next
    _GUICtrlListView_EndUpdate($hListView)
    Case 2 ; 2-dimensioned array
    _GUICtrlListView_BeginUpdate($hListView)
    Local $first_row
    For $r = 0 To UBound($array, 1) - 1
    If $r = 0 Then
    $first_row = _GUICtrlListView_AddItem($hListView, $array[$r][0], 0)
    Else
    _GUICtrlListView_AddItem($hListView, $array[$r][0], 0)
    EndIf
    Next
    For $r = 0 To UBound($array, 1) - 1
    For $c = 1 To UBound($array, 2) - 1
    ;ConsoleWrite($array[$r][$c] & " " & VarGetType($array[$r][$c]) & @CRLF & @CRLF)
    _GUICtrlListView_AddSubItem($hListView, $first_row + $r, $array[$r][$c], $c, 0)
    Next
    Next
    _GUICtrlListView_EndUpdate($hListView)
    Case Else
    Return SetError(2, 0, 0) ; invalid array (over 2 dimensions)
    EndSwitch
    Return
    EndFunc

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

    Func _GUICtrlCreateListViewEx($lText, $lX, $lY, $lWidth = 50, $lHeight = 50, $lStyle = 0, $lExStyle = 0)
    _GDIPlus_Startup()
    Local $hBitmap_Icon
    $lStyle = BitOR($lStyle, $LVS_REPORT, $LVS_OWNERDRAWFIXED, $LVS_SHOWSELALWAYS, $LVS_SINGLESEL)
    $lExStyle = BitOR($lExStyle, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_TRACKSELECT)
    Local $cListView = GUICtrlCreateListView($lText, $lX, $lY, $lWidth, $lHeight, $lStyle)
    $hListView = GUICtrlGetHandle($cListView)
    _GUICtrlListView_SetExtendedListViewStyle($hListView, $lExStyle)
    ; create checkbox images check and uncheck
    $hIml_Listview = _GUIImageList_Create(16, 16, 5, 3)
    $hBitmap_Icon = _Load_BMP_From_Mem(_Icon_Image_Checkbox_Unchecked(), True)
    _GUIImageList_Add($hIml_Listview, $hBitmap_Icon)
    _WinAPI_DeleteObject($hBitmap_Icon)
    $hBitmap_Icon = _Load_BMP_From_Mem(_Icon_Image_Checkbox_Checked(), True)
    _GUIImageList_Add($hIml_Listview, $hBitmap_Icon)
    _WinAPI_DeleteObject($hBitmap_Icon)
    Return $cListView
    EndFunc

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

    Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
    Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    Local $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom")
    Local $nNotifyCode = DllStructGetData($tNMHDR, "Code")
    ; if header size is changed, change size of edit controls
    Switch $nNotifyCode
    Case $HDN_ITEMCHANGED, $HDN_ITEMCHANGEDW
    For $i = 1 To $aProgress[0][0]
    _MoveEdit($hListView, $aProgress[$i][0], $aProgress[$i][1], $aProgress[$i][2])
    Next
    EndSwitch
    ; if checkbox image is clicked
    Switch $hWndFrom
    Case $hListView
    Switch $nNotifyCode
    Case $NM_CLICK
    Local $tINFO = DllStructCreate($tagNMITEMACTIVATE, $lParam)
    Local $iItem = DllStructGetData($tINFO, "Index")
    Local $iSubitem = DllStructGetData($tINFO, "SubItem")
    ; click event for checkboxes in column 2
    If $iSubitem == $checkbox_column And StringLen(_GUICtrlListView_GetItemText($hListView, $iItem, $iSubitem)) > 0 Then
    ;ConsoleWrite("painting row "&$iItem+1&" col "&$iSubitem+1&@CRLF)
    _GUICtrlListView_SetItemImage($hListView, $iItem, Not _GUICtrlListView_GetItemImage($hListView, $iItem, $iSubitem), $iSubitem)
    EndIf
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIFY

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

    Func WM_DRAWITEM($hWnd, $Msg, $wParam, $lParam)
    ;~ ConsoleWrite($hWnd & " " & $Msg & " " & $wParam & " " & $lParam & @CRLF)
    Local $tagDRAWITEMSTRUCT, $iBrushColor, $cID, $itmID, $itmAction, $itmState, $hItm, $hDC
    $timer = TimerInit()
    $tagDRAWITEMSTRUCT = DllStructCreate( _
    "uint cType;" & _
    "uint cID;" & _
    "uint itmID;" & _
    "uint itmAction;" & _
    "uint itmState;" & _
    "hwnd hItm;" & _
    "hwnd hDC;" & _
    "int itmRect[4];" & _
    "dword itmData" _
    , $lParam)
    If DllStructGetData($tagDRAWITEMSTRUCT, "cType") <> $ODT_LISTVIEW Then Return $GUI_RUNDEFMSG
    $cID = DllStructGetData($tagDRAWITEMSTRUCT, "cID")
    $itmID = DllStructGetData($tagDRAWITEMSTRUCT, "itmID")
    $itmAction = DllStructGetData($tagDRAWITEMSTRUCT, "itmAction")
    $itmState = DllStructGetData($tagDRAWITEMSTRUCT, "itmState")
    $hItm = DllStructGetData($tagDRAWITEMSTRUCT, "hItm")
    $hDC = DllStructGetData($tagDRAWITEMSTRUCT, "hDC")
    Local $aDefaultVariables[9] = [$tagDRAWITEMSTRUCT, $iBrushColor, $cID, $itmID, $itmAction, $itmState, $hItm, $hDC]
    Switch $cID ; will look for ControlID, not window handle.
    Case $cListView
    Switch $itmAction
    Case $ODA_DRAWENTIRE
    Local $aRowColors[2] = [0xFDFDFD, 0xEEDDBB]
    Local $aRectMargins[4] = [6, -1, -4, 0]
    Local $aTextFormatting[5] = [-1, _
    BitOR($DT_VCENTER, $DT_SINGLELINE, $DT_CENTER, $DT_END_ELLIPSIS), _
    BitOR($DT_VCENTER, $DT_SINGLELINE, $DT_CENTER, $DT_END_ELLIPSIS), _
    BitOR($DT_VCENTER, $DT_SINGLELINE, $DT_RIGHT, $DT_END_ELLIPSIS), _
    BitOR($DT_VCENTER, $DT_SINGLELINE, $DT_END_ELLIPSIS)]
    __WM_DRAWITEM_ListView($hListView, $aDefaultVariables, $aRowColors, $aRectMargins, $aTextFormatting)
    ; end case
    EndSwitch
    ; end case
    EndSwitch
    ;~ ConsoleWrite(Round(TimerDiff($timer),2) & @TAB & "WM_DRAWITEM" & @CRLF)
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_DRAWITEM

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

    Func __WM_DRAWITEM_ListView($hListView, ByRef $aDefaultVariables, ByRef $aRowColors, ByRef $aRectMargins, ByRef $aTextFormatting)
    Local $iSubItemCount = _GUICtrlListView_GetColumnCount($hListView)
    If UBound($aTextFormatting) < $iSubItemCount Then Return ConsoleWrite("!> Error: invalid parameters in __WM_DRAWITEM_ListView()" & @CRLF)
    Local $tagDRAWITEMSTRUCT, $iBrushColor, $cID, $itmID, $itmAction, $itmState, $hItm, $hDC
    $tagDRAWITEMSTRUCT = $aDefaultVariables[0]
    $iBrushColor = $aDefaultVariables[1]
    $cID = $aDefaultVariables[2]
    $itmID = $aDefaultVariables[3]
    $itmAction = $aDefaultVariables[4]
    $itmState = $aDefaultVariables[5]
    $hItm = $aDefaultVariables[6]
    $hDC = $aDefaultVariables[7]
    If _GUICtrlListView_GetItemSelected($hListView, $itmID) Then
    $iBrushColor = $aRowColors[1]
    Else
    $iBrushColor = $aRowColors[0]
    EndIf
    ; create a brush with the desired color:
    Local $aBrush = DllCall("gdi32.dll", "hwnd", "CreateSolidBrush", "int", $iBrushColor)
    ; get the rectangle for the whole row and fill it:
    Local $iLeft = DllStructGetData($tagDRAWITEMSTRUCT, "itmRect", 1)
    DllStructSetData($tagDRAWITEMSTRUCT, "itmRect", $iLeft + 0, 1) ; +0 is the left margin
    _WinAPI_FillRect($hDC, DllStructGetPtr($tagDRAWITEMSTRUCT, "itmRect"), $aBrush[0])
    ; draw the text in each subitem
    For $i = 0 To $iSubItemCount - 1
    ; get subitem text:
    Local $iSubItmText = _GUICtrlListView_GetItemText($hListView, $itmID, $i)
    ;~ ConsoleWrite($itmID & " ")
    ; get subitem coordinates for drawing its respective text:
    Local $aSubItmRect = _GUICtrlListView_GetSubItemRect($hListView, $itmID, $i)
    ; the function above accepts not only subitems (one-based index), but also main item (index=0)
    ; pass the coordinates to a DLL struct:
    Local $iSubItmRect = DllStructCreate("int Left;int Top;int Right;int Bottom")
    DllStructSetData($iSubItmRect, 1, $aSubItmRect[0] + $aRectMargins[0]) ; left margin
    DllStructSetData($iSubItmRect, 2, $aSubItmRect[1] + $aRectMargins[1]) ; upper margin
    DllStructSetData($iSubItmRect, 3, $aSubItmRect[2] + $aRectMargins[2]) ; right margin
    DllStructSetData($iSubItmRect, 4, $aSubItmRect[3] + $aRectMargins[3]) ; bottom margin
    Local $tRect = DllStructGetPtr($iSubItmRect)
    ;#cs
    If $cID == $cListView And StringLen($iSubItmText) > 0 And $aTextFormatting[$i] <> - 1 Then
    Local $hIcon = _GUIImageList_GetIcon($hIml_Listview, _GUICtrlListView_GetItemImage($hListView, $itmID, $i))
    If $i = 0 Then ; the first column of a listview needs more handling than the other columns (sub-items)
    #cs
    ; positioning for the icon:
    DllStructSetData($iSubItmRect, "Left", DllStructGetData($iSubItmRect, "Left") + 12)
    _WinAPI_DrawIconEx($hDC, DllStructGetData($iSubItmRect, "Left") - 16, Int((DllStructGetData($iSubItmRect, "Bottom") + DllStructGetData($iSubItmRect, "Top") - 16)/2) + $iAdjustV, $hIcon, 16, 16)
    ; positioning for the text:
    DllStructSetData($iSubItmRect, "Left", DllStructGetData($iSubItmRect, "Left") + 4)
    #ce
    ; draw checkbox images
    ElseIf $i == $checkbox_column Then
    _WinAPI_DrawIconEx($hDC, DllStructGetData($iSubItmRect, "Left"), Int((DllStructGetData($iSubItmRect, "Bottom") + DllStructGetData($iSubItmRect, "Top") - 16) / 2) - 1 + $iAdjustV, $hIcon, 16, 16)
    ; positioning for the text:
    DllStructSetData($iSubItmRect, "Left", DllStructGetData($iSubItmRect, "Left") + 20)
    EndIf
    _GUIImageList_DestroyIcon($hIcon)
    EndIf
    ;#ce
    ; column 3 has no text content so return here
    If $i == $edit_column Then
    ; if focus on edit controls
    Local $focus = ControlGetFocus($hGUI)
    If StringInStr( $focus, "Edit") Then
    ConsoleWrite("Jetzt" & " ")
    Sleep(1000)
    GUICtrlSetState(6, $GUI_FOCUS)
    EndIf
    _MoveEdit($hListView, $aProgress[$itmID][0], $aProgress[$itmID][1], $aProgress[$itmID][2])
    Return
    EndIf
    If $aTextFormatting[$i] = -1 Then
    ; do nothing (don't draw any text)
    Else
    ;ConsoleWrite($hDC & " " & $iSubItmText& " " & $tRect& " " & $aTextFormatting[$i] &@CRLF & "------------------------------------------"&@CRLF)
    _WinAPI_DrawText($hDC, $iSubItmText, $tRect, $aTextFormatting[$i])
    EndIf
    Next
    EndFunc ;==>__WM_DRAWITEM_ListView

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

    Func WM_MEASUREITEM($hWnd, $Msg, $wParam, $lParam)
    Local $tMEASUREITEMS = DllStructCreate("uint cType;uint cID;uint itmID;uint itmW;uint itmH;ulong_ptr itmData", $lParam)
    If DllStructGetData($tMEASUREITEMS, "cType") <> $ODT_LISTVIEW Then Return $GUI_RUNDEFMSG
    DllStructSetData($tMEASUREITEMS, "itmH", $iListView_row_height) ; row height
    Return 1
    EndFunc ;==>WM_MEASUREITEM

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

    ; Based on File to Base64 String Code Generator
    ; by UEZ
    ; <a href='http://www.autoitscript.com/forum/topic/...ng-code-generator-v103-build-2' class='bbc_url' title=''>http://www.autoitscript.com/forum/topic/..…or-v103-build-2</a>
    ;======================================================================================
    ; Function Name: Load_BMP_From_Mem
    ; Description: Loads an image which is saved as a binary string and converts it to a bitmap or hbitmap
    ;
    ; Parameters: $bImage: the binary string which contains any valid image which is supported by GDI+
    ; Optional: $hHBITMAP: if false a bitmap will be created, if true a hbitmap will be created
    ;
    ; Remark: hbitmap format is used generally for GUI internal images, $bitmap is more a GDI+ image format
    ; Don't forget _GDIPlus_Startup() and _GDIPlus_Shutdown()
    ;
    ; Requirement(s): GDIPlus.au3, Memory.au3 and _GDIPlus_BitmapCreateDIBFromBitmap() from WinAPIEx.au3
    ; Return Value(s): Success: handle to bitmap (GDI+ bitmap format) or hbitmap (WinAPI bitmap format),
    ; Error: 0
    ; Error codes: 1: $bImage is not a binary string
    ; 2: unable to create stream on HGlobal
    ; 3: unable to create bitmap from stream
    ;
    ; Author(s): UEZ
    ; Additional Code: thanks to progandy for the MemGlobalAlloc and tVARIANT lines and
    ; Yashied for _GDIPlus_BitmapCreateDIBFromBitmap() from WinAPIEx.au3
    ; Version: v0.97 Build 2012-01-04 Beta
    ;=======================================================================================
    Func _Load_BMP_From_Mem($bImage, $hHBITMAP = False)
    If Not IsBinary($bImage) Then Return SetError(1, 0, 0)
    Local $aResult
    Local Const $memBitmap = Binary($bImage) ;load image saved in variable (memory) and convert it to binary
    Local Const $len = BinaryLen($memBitmap) ;get length of image
    Local Const $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE) ;allocates movable memory ($GMEM_MOVEABLE = 0x0002)
    Local Const $pData = _MemGlobalLock($hData) ;translate the handle into a pointer
    Local $tMem = DllStructCreate("byte[" & $len & "]", $pData) ;create struct
    DllStructSetData($tMem, 1, $memBitmap) ;fill struct with image data
    _MemGlobalUnlock($hData) ;decrements the lock count associated with a memory object that was allocated with GMEM_MOVEABLE
    $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $pData, "int", True, "ptr*", 0) ;Creates a stream object that uses an HGLOBAL memory handle to store the stream contents
    If @error Then SetError(2, 0, 0)
    Local Const $hStream = $aResult[3]
    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0) ;Creates a Bitmap object based on an IStream COM interface
    If @error Then SetError(3, 0, 0)
    Local Const $hBitmap = $aResult[2]
    Local $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data; ptr")
    DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $hStream, "dword", 8 + 8 * @AutoItX64, _
    "dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT)) ;release memory from $hStream to avoid memory leak
    $tMem = 0
    $tVARIANT = 0
    If $hHBITMAP Then
    Local Const $hHBmp = _GDIPlus_BitmapCreateDIBFromBitmap($hBitmap)
    _GDIPlus_BitmapDispose($hBitmap)
    Return $hHBmp
    EndIf
    Return $hBitmap
    EndFunc ;==>_Load_BMP_From_Mem

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

    Func _GDIPlus_BitmapCreateDIBFromBitmap($hBitmap)
    Local $tBIHDR, $Ret, $tData, $pBits, $hResult = 0
    $Ret = DllCall($ghGDIPDll, 'uint', 'GdipGetImageDimension', 'ptr', $hBitmap, 'float*', 0, 'float*', 0)
    If (@error) Or ($Ret[0]) Then Return 0
    $tData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $Ret[2], $Ret[3], $GDIP_ILMREAD, $GDIP_PXF32ARGB)
    $pBits = DllStructGetData($tData, 'Scan0')
    If Not $pBits Then Return 0
    $tBIHDR = DllStructCreate('dword;long;long;ushort;ushort;dword;dword;long;long;dword;dword')
    DllStructSetData($tBIHDR, 1, DllStructGetSize($tBIHDR))
    DllStructSetData($tBIHDR, 2, $Ret[2])
    DllStructSetData($tBIHDR, 3, $Ret[3])
    DllStructSetData($tBIHDR, 4, 1)
    DllStructSetData($tBIHDR, 5, 32)
    DllStructSetData($tBIHDR, 6, 0)
    $hResult = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBIHDR), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'dword', 0)
    If (Not @error) And ($hResult[0]) Then
    DllCall('gdi32.dll', 'dword', 'SetBitmapBits', 'ptr', $hResult[0], 'dword', $Ret[2] * $Ret[3] * 4, 'ptr', DllStructGetData($tData, 'Scan0'))
    $hResult = $hResult[0]
    Else
    $hResult = 0
    EndIf
    _GDIPlus_BitmapUnlockBits($hBitmap, $tData)
    Return $hResult
    EndFunc ;==>_GDIPlus_BitmapCreateDIBFromBitmap

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

    Func _Decompress_Binary_String_to_Bitmap($Base64String)
    $Base64String = Binary($Base64String)
    Local $iSize_Source = BinaryLen($Base64String)
    Local $pBuffer_Source = _WinAPI_CreateBuffer($iSize_Source)
    DllStructSetData(DllStructCreate('byte[' & $iSize_Source & ']', $pBuffer_Source), 1, $Base64String)
    Local $pBuffer_Decompress = _WinAPI_CreateBuffer(8388608)
    Local $Size_Decompressed = _WinAPI_DecompressBuffer($pBuffer_Decompress, 8388608, $pBuffer_Source, $iSize_Source)
    Local $b_Result = Binary(DllStructGetData(DllStructCreate('byte[' & $Size_Decompressed & ']', $pBuffer_Decompress), 1))
    _WinAPI_FreeMemory($pBuffer_Source)
    _WinAPI_FreeMemory($pBuffer_Decompress)
    Return $b_Result
    EndFunc ;==>_Decompress_Binary_String_to_Bitmap

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

    Func _Icon_Image_Checkbox_Unchecked()
    Local $Base64String
    $Base64String &= '7rBIAAABABAQEAFwCAAAaAUAABYAAMwAKAAYAJAAIAAYAVwZAQBAAQIYDgCAgAAAANfc3ADZ3t4AANvg4ADe4uIAAOLl5QDl6OgAAOns7ADs7+8AAO/x8QDx8/MAAPT19QD29/cAAPj5+QD6+/sAAPz9/QD+/v7wAP///xNc/wB/AD8A/z8APwA/AD8APwA/AD8ACAAb4HYLAAEJAOEBCgsMAA0ODxAREhISbeIBCQcC4gEIBwLiAQfbBwLiAQYHAuIBBQcC4gG2BAcC4gEDBwLiAQIHAv/jAQcC5AEGAuIB7BceAOCfHgN/AG0A4QZhAA=='
    Return _Decompress_Binary_String_to_Bitmap(_Base64Decode($Base64String))
    EndFunc ;==>_Icon_Image_Checkbox_Unchecked

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

    Func _Icon_Image_Checkbox_Checked()
    Local $Base64String
    $Base64String &= 'z7BIAAABABAQEAFwCAAAaAUAABYAAMwAKAAYAJAAIAAYAVwZAQBAAQIYDgCAgAAAAISEhADe3t5AAN7n5wDnAQbvCO8A7wEG9/cA9/EABv///xN4/wE/AD8A/z8APwA/AD8AHwAMAOB6CwAGAQkA4QEHCAkJCR4KAgDjAQcC5AEHCAKDAwLiAQYHBwICAwI54gEFBsABAwLjAQUCxgIkBOIBBAUCRQbjAVgEBQUCAuQBAwUCCPPkAQUCBwjkAQYC4gHsF3seAOCfA38AbQDhBmEA'
    Return _Decompress_Binary_String_to_Bitmap(_Base64Decode($Base64String))
    EndFunc ;==>_Icon_Image_Checkbox_Checked

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

    Func _Base64Decode($input_string)
    Local $struct = DllStructCreate("int")
    Local $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", "str", $input_string, "int", 0, "int", 1, "ptr", 0, "ptr", DllStructGetPtr($struct, 1), "ptr", 0, "ptr", 0)
    If @error Or Not $a_Call[0] Then Return SetError(1, 0, "")
    Local $a = DllStructCreate("byte[" & DllStructGetData($struct, 1) & "]")
    $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", "str", $input_string, "int", 0, "int", 1, "ptr", DllStructGetPtr($a), "ptr", DllStructGetPtr($struct, 1), "ptr", 0, "ptr", 0)
    If @error Or Not $a_Call[0] Then Return SetError(2, 0, "")
    Return DllStructGetData($a, 1)
    EndFunc ;==>_Base64Decode

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

    Func _ListView_InsertEdit($sHwnd, $sItemIndex, $sSubItemIndex = 0)
    If Not IsHWnd($sHwnd) Then $sHwnd = GUICtrlGetHandle($sHwnd)
    Local $iStyle = _WinAPI_GetWindowLong($sHwnd, $GWL_STYLE)
    If BitAND($iStyle, $WS_CLIPCHILDREN) <> $WS_CLIPCHILDREN Then
    _WinAPI_SetWindowLong($sHwnd, $GWL_STYLE, BitOR($iStyle, $WS_CLIPCHILDREN))
    EndIf
    Local $aRect
    If $sSubItemIndex = 0 Then
    $aRect = _GUICtrlListView_GetItemRect($sHwnd, $sItemIndex, 2)
    Else
    $aRect = _GUICtrlListView_GetSubItemRect($sHwnd, $sItemIndex, $sSubItemIndex)
    EndIf

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

    $aProgress[0][0] += 1
    ReDim $aProgress[$aProgress[0][0]+1][4]
    $aProgress[$aProgress[0][0]][0] = _Edit_Create($sHwnd, $aRect[0] + 6, $aRect[1] + 2, ($aRect[2] - $aRect[0]) - 12, ($aRect[3] - $aRect[1]) - 4)

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

    $aProgress[$aProgress[0][0]][1] = $sItemIndex
    $aProgress[$aProgress[0][0]][2] = $sSubItemIndex
    $aProgress[$aProgress[0][0]][3] = $sHwnd

    Return $aProgress[$aProgress[0][0]][0]
    EndFunc ;==>_ListView_InsertEdit

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

    Func _Edit_Create($hWnd, $iX, $iY, $iWidth = -1, $iHeight = -1, $iStyle = 0, $iExStyle = 0x00000200)
    $ids += 1

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

    $iStyle = BitOR($iStyle, $WS_TABSTOP, $WS_CHILD, $WS_VISIBLE, $ES_LEFT, $ES_AUTOHSCROLL, $ES_NOHIDESEL)
    Local $hEdit = _WinAPI_CreateWindowEx($iExStyle, "EDIT", "", $iStyle, $iX, $iY, $iWidth, $iHeight, $hWnd, $ids)
    _SendMessage($hEdit, $__EDITCONSTANT_WM_SETFONT, _WinAPI_GetStockObject($__EDITCONSTANT_DEFAULT_GUI_FONT), True) ; set font style

    ; testen
    _GUICtrlEdit_SetLimitText($hEdit, 0)
    _GUICtrlEdit_SetText($hEdit, "test"&$ids)

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

    Return $hEdit
    EndFunc ;==>_Edit_Create

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

    Func _MoveEdit($hListView, $hProgress, $sItemIndex, $sSubItemIndex)
    Local $aRect

    If $sSubItemIndex = 0 Then
    $aRect = _GUICtrlListView_GetItemRect($hListView, $sItemIndex, 2)
    Else
    $aRect = _GUICtrlListView_GetSubItemRect($hListView, $sItemIndex, $sSubItemIndex)
    EndIf

    If $aRect[1] < 10 Then
    _WinAPI_ShowWindow($hProgress, $SW_HIDE)
    ElseIf $aRect[1] >= 10 Then
    _WinAPI_ShowWindow($hProgress, $SW_SHOW)
    EndIf

    _WinAPI_MoveWindow($hProgress, $aRect[0] + 6, $aRect[1] + 2, ($aRect[2] - $aRect[0]) - 12, ($aRect[3] - $aRect[1]) - 4, True)
    EndFunc ;==>_MoveEdit

    [/autoit]

    Danke für eure Mühen!

  • Koordinaten relativ zu einem bestimmten control

    • Trolleule1337
    • 1. Juli 2013 um 14:14

    Ich hab auch kein Problem!
    Das mit dem Lokal im Globalen Bereich ist ja mal interessant, wusste ich nicht, bin wohl doch nicht so toll wie ich dachte :D

    Der Flash mit dem ByRef kam durch den Beitrag von BugFix: https://autoit.de/index.php?page=Thread&amp;postID=203773

    Jetzt merke ich erst, das

    [autoit]

    ;===============================================================================
    ; EDIT: Punkt 1 gestrichen, wie die Diskussion ergeben hat, war dies schlicht unsinnig.
    ;===============================================================================

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

    ;============== 2. Vermeidung Globaler Variablen
    #cs
    Warum soll ich überhaupt Globale Variablen verwenden? Hier wird meist die Antwort kommen:
    'Damit ich den Inhalt in verschiedenen Funktionen nutzen/verändern kann.'
    Aber das läßt sich auch anders lösen:
    #ce

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

    Local $myVar = 0

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

    _PlusEins($myVar)
    ConsoleWrite('$myVar: ' & $myVar & @CRLF)

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

    ; im Funktionskopf muß nicht der identische Variablenname stehen, erleichtert aber das Lesen
    ; die Variable wird der Funktion 'ByRef' übergeben ==> sie kann somit von der Funktion verändert werden
    ; ohne 'ByRef' erfolgt die Übergabe immer 'ByVar', d.h. eine Kopie der Quellvariable wird erzeugt
    Func _PlusEins(ByRef $myVar)
    $myVar += 1 ; kein Return erforderlich, da die Variable in ihrer Quelle geändert wird
    EndFunc

    [/autoit]

    das gleiche ist, wie (vllt. nicht das gleiche, aber den selben output liefert)

    [autoit]

    ;===============================================================================
    ; EDIT: Punkt 1 gestrichen, wie die Diskussion ergeben hat, war dies schlicht unsinnig.
    ;===============================================================================

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

    ;============== 2. Vermeidung Globaler Variablen
    #cs
    Warum soll ich überhaupt Globale Variablen verwenden? Hier wird meist die Antwort kommen:
    'Damit ich den Inhalt in verschiedenen Funktionen nutzen/verändern kann.'
    Aber das läßt sich auch anders lösen:
    #ce

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

    Local $myVar = 0

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

    _PlusEins()
    ConsoleWrite('$myVar: ' & $myVar & @CRLF)

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

    ; im Funktionskopf muß nicht der identische Variablenname stehen, erleichtert aber das Lesen
    ; die Variable wird der Funktion 'ByRef' übergeben ==> sie kann somit von der Funktion verändert werden
    ; ohne 'ByRef' erfolgt die Übergabe immer 'ByVar', d.h. eine Kopie der Quellvariable wird erzeugt
    Func _PlusEins()
    $myVar += 1 ; kein Return erforderlich, da die Variable in ihrer Quelle geändert wird
    EndFunc

    [/autoit]

    Kann mir jemand erklären was das Beispiel von BugFix soll????? Denn wenn ich das mit ByRef jetzt richtig verstanden habe, macht das nur bei einer Paramterübergabe zwischen zwei Funktionen Sinn...

    Andy: Aus irgendwelchen nicht zu meinem Problem passenden Funktionen die rauszusuchen, die am ähnlichsten ist und dann irgendwelche programmiertechnischen Klimmzüge zu machen ist alles andere als ein Ausdruck von "Perfektion"!

    Was meinst du damit?


    Danke

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™