- Offizieller Beitrag
Servus.
Ich habe Chip ein Beispielscript geschrieben und dabei festgestellt, das die Struc $tagNMLVCUSTOMDRAW als x64 Code nicht läuft.
Die selben Probleme gibt es ja bei $tagNMITEMACTIVATE, dazu habe ich eine Lösung von progandy gefunden.
Hat zufällig jemand eine Lösung wie ich $tagNMLVCUSTOMDRAW anpassen muß,das die Struc auf x64 lauffähig wird?
Hier mal eine Besipeilscript:
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <StructureConstants.au3>
#include <WindowsConstants.au3>
Global Const $mytagNMITEMACTIVATE = "hwnd hWndFrom;uint_ptr IDFrom;INT_ptr Code;int Index;int SubItem;int NewState;int OldState;" & _
"int Changed;int X;int Y;int lParam;int KeyFlags"
$Form1 = GUICreate("Form1", 625, 443, 192, 124)
$ListView1 = GUICtrlCreateListView("ID|Name|Port|Status|Online|Max Clients|Uptime", 24, 16, 561, 281, BitOR($LVS_NOSORTHEADER, $LVS_SINGLESEL))
$hListView = GUICtrlGetHandle($ListView1)
GUICtrlCreateListViewItem("1|test|1234", $ListView1)
GUICtrlCreateListViewItem("2|noch einer|6434", $ListView1)
GUICtrlCreateListViewItem("44|der letzte|1010", $ListView1)
$Button1 = GUICtrlCreateButton("Button1", 32, 312, 75, 25)
[/autoit] [autoit][/autoit] [autoit]GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iCode, $tNMHDR, $tInfo
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hListView
Switch $iCode
Case $NM_CUSTOMDRAW
Local $Selected1 = ControlListView($Form1, "", $ListView1, "GetSelected", 0)
Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $ilParam)
Local $iDrawStage, $iItem, $iSubitem, $hDC, $iColor1, $iColor2, $iColor3
$iDrawStage = DllStructGetData($tCustDraw, 'dwDrawStage')
Switch $iDrawStage
Case $CDDS_ITEMPREPAINT
Return $CDRF_NOTIFYSUBITEMDRAW
Case BitOR($CDDS_ITEMPREPAINT, $CDDS_SUBITEM)
$iItem = DllStructGetData($tCustDraw, 'dwItemSpec')
If $Selected1 = $iItem Then
$iColor1 = RGB2BGR(0x3399FF); Item wurde ausgewählt Hintergrund ändern
$iColor2 = RGB2BGR(0xFFFFFF)
Else
$iColor1 = RGB2BGR(0xFFFFFF)
$iColor2 = RGB2BGR(0x000000)
EndIf
DllStructSetData($tCustDraw, 'clrTextBk', $iColor1)
DllStructSetData($tCustDraw, 'clrText', $iColor2)
Return $CDRF_NEWFONT
EndSwitch
Case $NM_CLICK, $NM_RCLICK
Local $tInfo = DllStructCreate($mytagNMITEMACTIVATE, $ilParam)
Local $sCurSel = _GUICtrlListView_GetItemText($hListView, DllStructGetData($tInfo, "Index"))
ConsoleWrite("Ausgewähltes Item : "&$sCurSel & @CRLF)
EndSwitch
EndSwitch
Return $__LISTVIEWCONSTANT_GUI_RUNDEFMSG
EndFunc ;==>_WM_NOTIFY
Func RGB2BGR($iColor)
Return BitAND(BitShift(String(Binary($iColor)), 8), 0xFFFFFF)
EndFunc ;==>RGB2BGR
Achso, hatte ich fast vergessen, das obige Script soll das selektierte Item bei nicht fokusiertem Listview genauso anzeigen,
als wenn das Listview den Fokus hätte. Funzt bei X86 einwandfrei.....