Jump to content

mLipok

MVPs
  • Posts

    11,654
  • Joined

  • Last visited

  • Days Won

    62

mLipok last won the day on January 16

mLipok had the most liked content!

About mLipok

  • Birthday 07/19/1978

Profile Information

  • Member Title
    Sometimes... even usually I'm nitpicky.
  • Location
    Europe, Poland, Upper Silesia, Zabrze
  • Interests
    ¯\_(ツ)_/¯

Recent Profile Visitors

28,775 profile views

mLipok's Achievements

  1. is'nt cdo.message end of life?
  2. Partially solved : #AutoIt3Wrapper_UseX64=y #include <GUIConstantsEx.au3> #include <SendMessage.au3> #include <WinAPIGdi.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> #SciTE4AutoIt3_Dynamic_Include_Path=;..\NetWebView2Lib.au3 #SciTE4AutoIt3_Dynamic_Include=y ;dynamic.include=y/n #SciTE4AutoIt3_Dynamic_Include_whiletyping=y ;dynamic.include.whiletyping=y/n #SciTE4AutoIt3_Dynamic_Include_recursive_check=y ;dynamic.include.recursive.check=n/y #SciTE4AutoIt3_Dynamic_Include_use_local_cache=y ;dynamic.include.use.local.cache=n/y #SciTE4AutoIt3_Dynamic_Include_version=prod ;dynamic.include.version=prod/beta #SciTE4AutoIt3_Dynamic_Include_verboselevel=0 ;dynamic.include.verbose.level=0/1/2 ; 0=disabled; 1=Timing per Function; 2=1+Total timing #SciTE4AutoIt3_Dynamic_Include_Always_Update_Local_File=n ;dynamic.include.always.update.local.file=n/y #SciTE4AutoIt3_AutoItTools_debug=n ;debug.autoIttools=n/y #SciTE4AutoIt3_AutoItDynamicIncludes_debug=n ;debug.AutoItDynamicIncludes=n/y #SciTE4AutoIt3_AutoItAutocomplete_debug=n ;debug.autoitautocomplet=n/y #SciTE4AutoIt3_AutoItGotoDefinition_debug=n ;debug.autoitgotodefinition=n/y #SciTE4AutoIt3_AutoItIndentFix_debug=n ;debug.autoitindentfix=n/y #include "..\NetWebView2Lib.au3" ; ============================================================================== ; WebView2 Multi-Channel Presentation Script^ ; ============================================================================== ; Global objects ; GUI & Controls Global $hGUI, $idLabelStatus Main() Func Main() Local $oMyError = ObjEvent("AutoIt.Error", __NetWebView2_COMErrFunc) #forceref $oMyError ; Create the UI Local $iHeight = 800 $hGUI = GUICreate("WebView2 .NET Manager - Demo: " & @ScriptName, 1100, $iHeight, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPCHILDREN)) $idLabelStatus = GUICtrlCreateLabel("Status: Initializing Engine...", 10, $iHeight -20 , 880, 20) GUICtrlSetFont(-1, 9, 400, 0, "Segoe UI") ; Initialize WebView2 Manager and register events Local $oWebV2M = _NetWebView2_CreateManager("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36 Edg/144.0.0.0", "", "--mute-audio") $_g_oWeb = $oWebV2M If @error Then Return SetError(@error, @extended, $oWebV2M) ; Initialize JavaScript Bridge Local $oJSBridge = _NetWebView2_GetBridge($oWebV2M, "_BridgeMyEventsHandler_") If @error Then Return SetError(@error, @extended, $oWebV2M) Local $sProfileDirectory = @TempDir & "\NetWebView2Lib-UserDataFolder" _NetWebView2_Initialize($oWebV2M, $hGUI, $sProfileDirectory, 0, 0, 0, 0, True, True, True, 1.2, "0x2B2B2B") GUISetState(@SW_SHOW, $hGUI) WinSetOnTop($hGUI, '', True) ConsoleWrite("! ===" & @ScriptLineNumber & @CRLF) ;~ MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, 0) Local $s_PDF_FileFullPath ;~ GUISetState(@SW_LOCK, $hGUI) $s_PDF_FileFullPath = "file:///" & @ScriptDir & '/FileViewerDemo_1.pdf' _NetWebView2_Navigate($oWebV2M, $s_PDF_FileFullPath) ;~ GUISetState(@SW_UNLOCK, $hGUI) MsgBox($MB_TOPMOST, "NORMAL TEST #" & @ScriptLineNumber, $s_PDF_FileFullPath, 0, $hGUI) Local $hWebView2_Window = _EnumWindow($hGUI) GUISetState(@SW_LOCK, ($hWebView2_Window)) $s_PDF_FileFullPath = "file:///" & @ScriptDir & '/FileViewerDemo_2.pdf' _NetWebView2_Navigate($oWebV2M, $s_PDF_FileFullPath) Sleep(1000) GUISetState(@SW_UNLOCK, ($hWebView2_Window)) MsgBox($MB_TOPMOST, "LOCK/UNLOCK TEST #" & @ScriptLineNumber, $s_PDF_FileFullPath, 0, $hGUI) _SendMessage($hWebView2_Window, $WM_SETREDRAW, False, 0) ; Disables ; https://www.autoitscript.com/forum/topic/199172-disable-gui-updating-repainting/ $s_PDF_FileFullPath = "file:///" & @ScriptDir & '/FileViewerDemo_1.pdf' _NetWebView2_Navigate($oWebV2M, $s_PDF_FileFullPath) Sleep(1000) _SendMessage($hWebView2_Window, $WM_SETREDRAW, True, 0) ; Enables _WinAPI_RedrawWindow($hWebView2_Window, 0, 0, BitOR( $RDW_FRAME, $RDW_INVALIDATE, $RDW_ALLCHILDREN)) ; Repaints MsgBox($MB_TOPMOST, "$WM_SETREDRAW TEST #" & @ScriptLineNumber, $s_PDF_FileFullPath, 0, $hGUI) ; Main Loop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) _NetWebView2_CleanUp($oWebV2M, $oJSBridge) EndFunc ;==>Main Func _EnumWindow($hWnd) Local $aData = _WinAPI_EnumChildWindows($hWnd) ConsoleWrite("! $aData[1][0] = " & $aData[1][0] & @CRLF) ;~ _ArrayDisplay($aData, '_WinAPI_EnumChildWindows') If Not @error And UBound($aData) Then Return $aData[1][0] Return SetError(1, @extended, False) EndFunc ;==>Example
  3. Thanks for findings. Reported: https://www.autoitscript.com/trac/autoit/ticket/4067#ticket
  4. Today I was in need to study about _WinAPI_EnumWindow***() functions I stick with questions about _WinAPI_EnumWindowStations() Accordingly to https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enumwindowstationsa : So I run this example _WinAPI_EnumWindowStations.au3 and nothing happens. Thus my questions: 1. What "window stations in the current session" means ? and 2. Why _WinAPI_EnumWindowStations() doesn't return any array in my case ? Regards mLipok
  5. I just worked on 4-FileViewerDemo.au3 and I hit AutoIt problem with GUI redrawing window. Here is my modified version of 4-FileViewerDemo.au3 : #AutoIt3Wrapper_UseX64=y #include <GUIConstantsEx.au3> #include <SendMessage.au3> #include <WinAPIGdi.au3> #include <WindowsConstants.au3> #SciTE4AutoIt3_Dynamic_Include_Path=;..\NetWebView2Lib.au3 #SciTE4AutoIt3_Dynamic_Include=y ;dynamic.include=y/n #SciTE4AutoIt3_Dynamic_Include_whiletyping=y ;dynamic.include.whiletyping=y/n #SciTE4AutoIt3_Dynamic_Include_recursive_check=y ;dynamic.include.recursive.check=n/y #SciTE4AutoIt3_Dynamic_Include_use_local_cache=y ;dynamic.include.use.local.cache=n/y #SciTE4AutoIt3_Dynamic_Include_version=prod ;dynamic.include.version=prod/beta #SciTE4AutoIt3_Dynamic_Include_verboselevel=0 ;dynamic.include.verbose.level=0/1/2 ; 0=disabled; 1=Timing per Function; 2=1+Total timing #SciTE4AutoIt3_Dynamic_Include_Always_Update_Local_File=n ;dynamic.include.always.update.local.file=n/y #SciTE4AutoIt3_AutoItTools_debug=n ;debug.autoIttools=n/y #SciTE4AutoIt3_AutoItDynamicIncludes_debug=n ;debug.AutoItDynamicIncludes=n/y #SciTE4AutoIt3_AutoItAutocomplete_debug=n ;debug.autoitautocomplet=n/y #SciTE4AutoIt3_AutoItGotoDefinition_debug=n ;debug.autoitgotodefinition=n/y #SciTE4AutoIt3_AutoItIndentFix_debug=n ;debug.autoitindentfix=n/y #include "..\NetWebView2Lib.au3" ; ============================================================================== ; WebView2 Multi-Channel Presentation Script^ ; ============================================================================== ; Global objects ; GUI & Controls Global $hGUI, $idLabelStatus Main() Func Main() Local $oMyError = ObjEvent("AutoIt.Error", __NetWebView2_COMErrFunc) #forceref $oMyError ; Create the UI Local $iHeight = 800 $hGUI = GUICreate("WebView2 .NET Manager - Demo: " & @ScriptName, 1100, $iHeight, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPCHILDREN)) $idLabelStatus = GUICtrlCreateLabel("Status: Initializing Engine...", 10, $iHeight -20 , 880, 20) GUICtrlSetFont(-1, 9, 400, 0, "Segoe UI") ; Initialize WebView2 Manager and register events Local $oWebV2M = _NetWebView2_CreateManager("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36 Edg/144.0.0.0", "", "--mute-audio") $_g_oWeb = $oWebV2M If @error Then Return SetError(@error, @extended, $oWebV2M) ; Initialize JavaScript Bridge Local $oJSBridge = _NetWebView2_GetBridge($oWebV2M, "_BridgeMyEventsHandler_") If @error Then Return SetError(@error, @extended, $oWebV2M) Local $sProfileDirectory = @TempDir & "\NetWebView2Lib-UserDataFolder" _NetWebView2_Initialize($oWebV2M, $hGUI, $sProfileDirectory, 0, 0, 0, 0, True, True, True, 1.2, "0x2B2B2B") GUISetState(@SW_SHOW, $hGUI) WinSetOnTop($hGUI, '', True) ConsoleWrite("! ===" & @ScriptLineNumber & @CRLF) ;~ MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, 0) Local $s_PDF_FileFullPath GUISetState(@SW_LOCK, $hGUI) $s_PDF_FileFullPath = "file:///" & @ScriptDir & '/FileViewerDemo_1.pdf' _NetWebView2_Navigate($oWebV2M, $s_PDF_FileFullPath) GUISetState(@SW_UNLOCK, $hGUI) MsgBox($MB_TOPMOST, "NORMAL TEST #" & @ScriptLineNumber, $s_PDF_FileFullPath, 0, $hGUI) $oWebV2M.LockWebView() GUISetState(@SW_LOCK, $hGUI) $s_PDF_FileFullPath = "file:///" & @ScriptDir & '/FileViewerDemo_2.pdf' _NetWebView2_Navigate($oWebV2M, $s_PDF_FileFullPath) Sleep(5000) GUISetState(@SW_UNLOCK, $hGUI) MsgBox($MB_TOPMOST, "LOCK/UNLOCK TEST #" & @ScriptLineNumber, $s_PDF_FileFullPath, 0, $hGUI) _SendMessage($hGUI, $WM_SETREDRAW, False, 0) ; Disables ; https://www.autoitscript.com/forum/topic/199172-disable-gui-updating-repainting/ $s_PDF_FileFullPath = "file:///" & @ScriptDir & '/FileViewerDemo_1.pdf' _NetWebView2_Navigate($oWebV2M, $s_PDF_FileFullPath) Sleep(1000) _SendMessage($hGUI, $WM_SETREDRAW, True, 0) ; Enables _WinAPI_RedrawWindow($hGUI, 0, 0, BitOR( $RDW_FRAME, $RDW_INVALIDATE, $RDW_ALLCHILDREN)) ; Repaints MsgBox($MB_TOPMOST, "$WM_SETREDRAW TEST #" & @ScriptLineNumber, $s_PDF_FileFullPath, 0, $hGUI) ; Main Loop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) _NetWebView2_CleanUp($oWebV2M, $oJSBridge) EndFunc ;==>Main To get this worked take a look here: https://github.com/ioa747/NetWebView2Lib Question 1: GUISetState(@SW_LOCK, $hGUI) ..... GUISetState(@SW_UNLOCK, $hGUI) It doesn't work as I would expect thus my question is: Why does the PDF content appear immediately and not after 5 seconds? GUISetState(@SW_LOCK, $hGUI) $s_PDF_FileFullPath = "file:///" & @ScriptDir & '/FileViewerDemo_2.pdf' _NetWebView2_Navigate($oWebV2M, $s_PDF_FileFullPath) Sleep(5000) GUISetState(@SW_UNLOCK, $hGUI) MsgBox($MB_TOPMOST, "LOCK/UNLOCK TEST #" & @ScriptLineNumber, $s_PDF_FileFullPath, 0, $hGUI) Question 2: In this part _SendMessage($hGUI, $WM_SETREDRAW, False, 0) ; Disables ; https://www.autoitscript.com/forum/topic/199172-disable-gui-updating-repainting/ $s_PDF_FileFullPath = "file:///" & @ScriptDir & '/FileViewerDemo_1.pdf' _NetWebView2_Navigate($oWebV2M, $s_PDF_FileFullPath) Sleep(1000) _SendMessage($hGUI, $WM_SETREDRAW, True, 0) ; Enables _WinAPI_RedrawWindow($hGUI, 0, 0, BitOR( $RDW_FRAME, $RDW_INVALIDATE, $RDW_ALLCHILDREN)) ; Repaints MsgBox($MB_TOPMOST, "$WM_SETREDRAW TEST #" & @ScriptLineNumber, $s_PDF_FileFullPath, 0, $hGUI) REDRAW is set to Falase on entire GUI window created by AutoIt How to stop REDRAWing only "Pane: WindowsForms10.Window.8.app.0.297b065_r18_ad1" ? AutoIt GUI with embeded WebView: UIASpy detect it this way: Queston 3: Why this following part hides the WebView2 embeded element instead only prevent to repaint them ? and Queston 4: Why I see FileViewerDemo_2.pdf on the Blue line/bar ? _SendMessage($hGUI, $WM_SETREDRAW, False, 0) ; Disables ; https://www.autoitscript.com/forum/topic/199172-disable-gui-updating-repainting/ $s_PDF_FileFullPath = "file:///" & @ScriptDir & '/FileViewerDemo_1.pdf' _NetWebView2_Navigate($oWebV2M, $s_PDF_FileFullPath) Sleep(1000) _SendMessage($hGUI, $WM_SETREDRAW, True, 0) ; Enables _WinAPI_RedrawWindow($hGUI, 0, 0, BitOR( $RDW_FRAME, $RDW_INVALIDATE, $RDW_ALLCHILDREN)) ; Repaints MsgBox($MB_TOPMOST, "$WM_SETREDRAW TEST #" & @ScriptLineNumber, $s_PDF_FileFullPath, 0, $hGUI)
  6. Thank you. My version was a case study of sorts, a proof of concept that it could be achieved this way. I'm curious if anyone can solve my list:
  7. Interesting Here is my variation. #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <WindowsConstants.au3> #include <String.au3> Global $idInput = -1 Test2() Exit Func Test2() Local $hgui = GUICreate("USPS thing", 300, 100) #forceref $hgui $idInput = GUICtrlCreateInput("", 20, 35, 260, 20) GUICtrlSetLimit(-1, 27) ; 22 digits + 5 spaces GUISetState() GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit WEnd EndFunc ;==>Test2 Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Local $iIDFrom = BitAND($wParam, 0xFFFF) Local $iCode = BitShift($wParam, 16) If $iIDFrom = $idInput And $iCode = $EN_CHANGE Then Local $aSel = _GUICtrlEdit_GetSel($idInput) Local $iPos = $aSel[0] Local $sCurrent = GUICtrlRead($idInput) ; 1. REGEX: Remove everything that is NOT a digit [^0-9] Local $sClean = StringRegExpReplace($sCurrent, "[^0-9]", "") Local Static $sEmptyMask = '*********************' $sClean = $sClean & StringLeft($sEmptyMask, 21 - StringLen($sClean)) ; 2. REGEX: Insert space every 4 digits ; Local $sFormatted = StringRegExpReplace($sClean, "(.{4})", "$1 ") Local $sFormatted = StringRegExpReplace($sClean, ".{4}", "$0.") $sFormatted = StringStripWS($sFormatted, 2) ; Remove trailing space If $sCurrent <> $sFormatted Then GUICtrlSetData($idInput, $sFormatted) ; 3. Adjust cursor position if text length changed If StringLen($sFormatted) > StringLen($sCurrent) Then $iPos += 1 If StringLen($sFormatted) < StringLen($sCurrent) Then $iPos -= 1 _GUICtrlEdit_SetSel($idInput, $iPos, $iPos) EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND ISSUES / TODO : to use 22 * not 21 to see all * at start to works well when you type numbers to works well when you use delete/backspace key
  8. I'm sorry. I forgot to mention it because I was very busy at the time—overworked. So I'm doing it now. Thanks. Works well.
  9. please take a look on the draft PR https://github.com/ioa747/NetWebView2Lib/pull/8
  10. I did test in 1-BasicDemo.au3 and just wondering why this ActiveX component work with #AutoIt3Wrapper_UseX64=y but also with: #AutoIt3Wrapper_UseX64=n Until now I thought that the ActiveX component had to be recompiled separately for both architectures as separate DLL files. Did I miss something ?
  11. This looks awesome. BIG THANKS
  12. Is it possible to use stuff like: https://gojs.net/latest/download.html to display diagrams in AutoIt GUI of cours with this component ? or https://github.com/summerstyle/jsonTreeViewer/blob/master/jsonTreeViewer.js example: https://summerstyle.github.io/jsonTreeViewer/ to display formated and colored JSON structure ? XML is simple: PDF the same: I just thinking about UNIVERSAL FILE VIEWER
  13. I managed to create such a temporary solution #include <GUIConstants.au3> #include <GuiListView.au3> Global $_hGUI = 0, $_hListView = 00 Global $_iListView_LastClickedRow = -1 Example() Func Example() ; create GUI window $_hGUI = GUICreate("Example", 500, 800) ; create ListView control Local $idListview = GUICtrlCreateListView("", 10, 10, 480, 780, BitOR($LVS_SINGLESEL, 0)) $_hListView = ControlGetHandle($_hGUI, '', $idListview) ; Enable extended control styles _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)) GUISetState(@SW_SHOW) ; Set ANSI format ;~ _GUICtrlListView_SetUnicodeFormat($idListview, False) _GUICtrlListView_BeginUpdate($idListview) _GUICtrlListView_AddColumn($idListview, "Column 0", 100) _GUICtrlListView_AddColumn($idListview, "Column 1", 100) Local $iMAX = 499 For $i = 0 To $iMAX _GUICtrlListView_AddItem($idListview, "Row " & $i & ": Col 0", 0) _GUICtrlListView_AddSubItem($idListview, $i, "Row " & $i & ": Col 1", 1) Next Local $iCount10 = 0, $iGroupID For $i = 0 To $iMAX If Mod($i, 10) = 0 Then $iGroupID = $iCount10 * 10 $iCount10 += 1 _GUICtrlListView_InsertGroup($idListview, -1, $iGroupID, 'GroupID=' & $iGroupID & ' for all rows with RowIndex in range <' & $iGroupID & ',' & ($iCount10 * 10) - 1 & '>') EndIf _GUICtrlListView_SetItemGroupID($idListview, $i, $iGroupID) Next _GUICtrlListView_EnableGroupView($idListview) _GUICtrlListView_EnsureVisible($idListview, 250) _GUICtrlListView_EndUpdate($idListview) GUIRegisterMsg($WM_NOTIFY, WM_NOTIFY) Local $aInfo, $s_GroupHeader ;~ $aInfo = _GUICtrlListView_GetGroupInfo($idListview, 240) $aInfo = _GUICtrlListView_GetGroupInfoByIndex($idListview, 24) ; REMARK: 0based ListView Index 24 is $sGroupHumanIndex = "[ #25 ]" $s_GroupHeader = $aInfo[0] ; please note that $s_GroupHeader does not contain an index in the displayed form [ #**** ] MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, 'Focus on $sGroupHumanIndex = "[ #25 ]" ' & @CRLF & 'Is it like following:' & @CRLF & $s_GroupHeader & @CRLF & 'It will be removed !') ; removing group for all 24* rows _GUICtrlListView_RemoveGroup($idListview, 240) ;~ $aInfo = _GUICtrlListView_GetGroupInfo($idListview, 250) $aInfo = _GUICtrlListView_GetGroupInfoByIndex($idListview, 24) ; REMARK: 0based ListView Index 24 is $sGroupHumanIndex = "[ #25 ]" $s_GroupHeader = $aInfo[0] ; please note that $s_GroupHeader does not contain an index in the displayed form [ #**** ] MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, 'Where is $sGroupHumanIndex = "[ #25 ]" GroupID=240 ?' & @CRLF & 'Was it removed ?' & @CRLF & @CRLF & 'What content is in $sGroupHumanIndex = "[ #25 ]" ?' & @CRLF & 'Is it like following:' & @CRLF & $s_GroupHeader) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>Example Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam If $hWnd = $_hGUI Then ; check if Our GUI - in case you create multiple GUI - Window Local $tItem = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) If $tItem.hWndFrom = $_hListView Then ; check if our ListView - in case you have few ListView on the same GUI - Window Local $iItemSpec = $tItem.dwItemSpec ; ItemIndex for "RowElement", GroupID for "GroupElement" ;~ If $tItem.Code = $NM_SETFOCUS Or $tItem.Code = $NM_HOVER Or $tItem.Code = $NM_SETCURSOR Or $tItem.Code = $NM_CLICK Or $tItem.Code = $NM_DBLCLK Or $tItem.Code = $NM_RCLICK Or $tItem.Code = $NM_RDBLCLK Then If $tItem.uItemState = $CDIS_SELECTED Or $tItem.Code = $NM_CLICK Or $tItem.Code = $NM_DBLCLK Or $tItem.Code = $NM_RCLICK Or $tItem.Code = $NM_RDBLCLK Then $_iListView_LastClickedRow = _GUICtrlListView_GetSelectionMark($_hListView) ConsoleWrite('! 1. $_iListView_LastClickedRow= ' & $_iListView_LastClickedRow & @CRLF) ;~ ConsoleWrite('! 1. Selection Mark = ' & & @CRLF) ;~ ConsoleWrite('! 2. $iItemSpec= ' & $iItemSpec & ' $tItem.dwItemType=' & $tItem.dwItemType & @CRLF) Return $GUI_RUNDEFMSG EndIf If $tItem.dwItemType = $LVCDI_ITEM Then ElseIf $tItem.dwItemType = $LVCDI_GROUP Then If $tItem.Code = $NM_SETFOCUS Or $tItem.Code = $NM_HOVER Or $tItem.Code = $NM_SETCURSOR Or $tItem.Code = $NM_CLICK Or $tItem.Code = $NM_DBLCLK Or $tItem.Code = $NM_RCLICK Or $tItem.Code = $NM_RDBLCLK Then ConsoleWrite('! 3. Selection Mark = ' & _GUICtrlListView_GetSelectionMark($_hListView) & @CRLF) ;~ ConsoleWrite('! 4. $iItemSpec= ' & $iItemSpec & @CRLF) Return $GUI_RUNDEFMSG ElseIf $tItem.Code = $NM_CUSTOMDRAW And $tItem.dwDrawStage = $CDDS_POSTPAINT Then ;~ ConsoleWrite('! PRE. Selection Mark = ' & _GUICtrlListView_GetSelectionMark($_hListView) & @CRLF) Local $iTemp_Row = _GUICtrlListView_GetSelectionMark($_hListView) If $_iListView_LastClickedRow <> $iTemp_Row Then $_iListView_LastClickedRow = $iTemp_Row ConsoleWrite('! 7. $_iListView_LastClickedRow= ' & $_iListView_LastClickedRow & @CRLF) EndIf ;~ ConsoleWrite("! $iItemSpec=" & $iItemSpec & " $tItem.Code=" & $tItem.Code & @CRLF) ;~ ConsoleWrite('! 5. Selection Mark = ' & _GUICtrlListView_GetSelectionMark($_hListView) & @CRLF) ;~ ConsoleWrite('! 6. $iItemSpec= ' & $iItemSpec & @CRLF) ElseIf $tItem.Code = $NM_CUSTOMDRAW And $tItem.dwDrawStage = $CDDS_PREPAINT Then ;~ ConsoleWrite('! POST. Selection Mark = ' & _GUICtrlListView_GetSelectionMark($_hListView) & @CRLF) Local $tRect = DllStructCreate($tagRECT, DllStructGetPtr($tItem, "left")) #Region ; create full row background (black) with a leading line (red) $tRect.bottom = $tRect.top + 16 Local $hBrush = _WinAPI_CreateSolidBrush(0) _WinAPI_FillRect($tItem.HDC, $tRect, $hBrush) _WinAPI_DeleteObject($hBrush) Local $hPen = _WinAPI_CreatePen($PS_SOLID, 1, _WinAPI_SwitchColor(0xFF0000)) ; RGB to BGR Local $oOrig = _WinAPI_SelectObject($tItem.HDC, $hPen) _WinAPI_DrawLine($tItem.HDC, $tRect.left + 5, $tRect.top + 8, $tRect.right - 5, $tRect.top + 8) _WinAPI_SelectObject($tItem.HDC, $oOrig) _WinAPI_DeleteObject($hPen) Local $aGroup = _GUICtrlListView_GetGroupInfo($tItem.hWndFrom, $iItemSpec) #EndRegion ; create full row background (black) with a leading line (red) #Region ; PREFIX Group with auto INDEX - text with your own color (dark grey) and your own background (light grey) - on the previously created full row background Local $iGroupIndex_0based = _GUICtrlListView_GetGroupIndexByGroupID($_hListView, $iItemSpec) ; auto count Group Index Local $sGroupHumanIndex = "[ #" & $iGroupIndex_0based + 1 & ' ]' $tRect.left += 10 _WinAPI_SetBkColor($tItem.HDC, _WinAPI_SwitchColor(0xAAAAAA)) ; RGB to BGR _WinAPI_SetBkMode($tItem.HDC, $OPAQUE) _WinAPI_SetTextColor($tItem.HDC, _WinAPI_SwitchColor(0x880000)) ; RGB to BGR _WinAPI_DrawText($tItem.HDC, $sGroupHumanIndex, $tRect, $DT_LEFT) #EndRegion ; PREFIX Group with auto INDEX - text with your own color (dark grey) and your own background (light grey) - on the previously created full row background #Region ; repaint the text with your own color (dark blue) and your own background (light blue) - on the previously created full row background $tRect.left += 80 _WinAPI_SetBkColor($tItem.HDC, _WinAPI_SwitchColor(0x55AAFF)) ; RGB to BGR _WinAPI_SetBkMode($tItem.HDC, $OPAQUE) _WinAPI_SetTextColor($tItem.HDC, _WinAPI_SwitchColor(0x0000FF)) ; RGB to BGR _WinAPI_DrawText($tItem.HDC, " " & $aGroup[0] & " ", $tRect, $DT_LEFT) #EndRegion ; repaint the text with your own color (dark blue) and your own background (light blue) - on the previously created full row background Return $CDRF_SKIPDEFAULT EndIf EndIf EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _GUICtrlListView_GetGroupIndexByGroupID($hWnd, $iGroupID) Local $iMaxIndex = _GUICtrlListView_GetGroupCount($hWnd) - 1 Local $aInfo For $i = 0 To $iMaxIndex $aInfo = _GUICtrlListView_GetGroupInfoByIndex($hWnd, $i) If $aInfo[2] = $iGroupID Then Return $i Next Return SetError(1, 0, -1) EndFunc ;==>_GUICtrlListView_GetGroupIndexByGroupID the main idea is here: ElseIf $tItem.dwItemType = $LVCDI_GROUP Then ...... ElseIf $tItem.Code = $NM_CUSTOMDRAW And $tItem.dwDrawStage = $CDDS_POSTPAINT Then Local $iTemp_Row = _GUICtrlListView_GetSelectionMark($_hListView) If $_iListView_LastClickedRow <> $iTemp_Row Then $_iListView_LastClickedRow = $iTemp_Row ConsoleWrite('! 7. $_iListView_LastClickedRow= ' & $_iListView_LastClickedRow & @CRLF) EndIf ......
  14. I need $LVS_SINGLESEL Yours solution automatically select all rows when I clicked the GroupHeader
×
×
  • Create New...