careca Posted June 23, 2020 Share Posted June 23, 2020 Hi forum, im trying to figure out how to do this and put it in a function with a simple syntax, such as: LVBK($Row, $Color) The problem is that all the code i find is built around GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") In this example i was messing with it, i identified what actually changed the background color, and it was this: Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aRowBK)) right now all rows become of the defined color, but that is besides the point, the point is all this code is very cryptic to me, have no idea on how to turn this into a callable function. Func WM_NOTIFY($hWnd, $msg, $wParam, $lParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $NM_CUSTOMDRAW Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aRowBK[2])) ;ConsoleWrite('Item '&$iItem&' BK: '&$aRowBK[$iIndex][1] & @CRLF) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Danp2 Posted June 23, 2020 Share Posted June 23, 2020 What about having your LVBK function just store the settings into an array. Then, within your WM_NOTIFY, you retrieve the array values for the current row and use them to establish the color for that row. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
careca Posted June 24, 2020 Author Share Posted June 24, 2020 Wouldn't that mean that the same items would be colored many times over and over? Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
KaFu Posted June 24, 2020 Share Posted June 24, 2020 (edited) Yes, it would be painted every time a drawing event occurs (e.g. LV was covered and is uncovered again). On the other hand that's necessary, as otherwise no table at all would be drawn. Look at the helpfile example for _GUIImageList_BeginDrag(), at the bottom you'll find the line "If BitAND($iItemSpec, 1) = 1 Then", that's where the item number is checked and it's either painted in white or blue. You can add a test there for id = 1 and set it to green, then you realize how it works, Edit: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> GUICreate("listview items", 220, 250, 100, 200) Local $idListview = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 230) ;,$LVS_SORTDESCENDING) Global $g_hListView = GUICtrlGetHandle($idListview) Local $idItem1 = GUICtrlCreateListViewItem("item1|col22|col23", $idListview) Local $idItem2 = GUICtrlCreateListViewItem("item2|col12|col13", $idListview) Local $idItem3 = GUICtrlCreateListViewItem("item3|col32|col33", $idListview) Local $idItem4 = GUICtrlCreateListViewItem("item4|col22|col23", $idListview) Local $idItem5 = GUICtrlCreateListViewItem("item5|col12|col13", $idListview) Local $idItem6 = GUICtrlCreateListViewItem("item6|col32|col33", $idListview) Local $idItem7 = GUICtrlCreateListViewItem("item7|col12|col13", $idListview) Local $idItem8 = GUICtrlCreateListViewItem("item8|col32|col33", $idListview) Global $s_Rows_to_Paint_Green = ";2;;5;" ; 0-based GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func WM_NOTIFY($hWndGUI, $iMsgID, $wParam, $lParam) #forceref $hWndGUI, $iMsgID, $wParam Local $tNMHDR, $iCode, $x, $y, $tNMLISTVIEW, $hWndFrom, $tDraw, $iDrawStage, $iItemSpec $tNMHDR = DllStructCreate($tagNMHDR, $lParam) If @error Then Return $iCode = DllStructGetData($tNMHDR, "Code") $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") Switch $hWndFrom Case $g_hListView Switch $iCode Case $NM_CUSTOMDRAW $tDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) $iDrawStage = DllStructGetData($tDraw, "dwDrawStage") $iItemSpec = DllStructGetData($tDraw, "dwItemSpec") Switch $iDrawStage Case $CDDS_PREPAINT Return $CDRF_NOTIFYITEMDRAW Case $CDDS_ITEMPREPAINT If StringInStr($s_Rows_to_Paint_Green, ";" & $iItemSpec & ";") Then DllStructSetData($tDraw, "clrTextBk", 0x00ff00) Return $CDRF_NEWFONT EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Edited June 24, 2020 by KaFu careca and Danyfirex 2 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Nine Posted June 24, 2020 Share Posted June 24, 2020 (edited) GUICtrlSetBkColor ($idItem3, 0x00FF00) ? or more precisely : #include <GUIConstantsEx.au3> #include <GuiListView.au3> GUICreate("listview items", 220, 250, 100, 200) Local $idListview = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 230) For $i = 1 to 10 GUICtrlCreateListViewItem("item" & $i & "|col" & $i & "2|col" & $i & "3", $idListview) Next LVBK ($idListview, 2, 0x00ff00) LVBK ($idListview, 5, 0x00ff00) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func LVBK ($ListView, $row, $color) GUICtrlSetBkColor (_GUICtrlListView_GetItemParam($ListView, $row),$color) EndFunc Edited June 24, 2020 by Nine pixelsearch and careca 1 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
careca Posted June 25, 2020 Author Share Posted June 25, 2020 (edited) Awesome @Nine this was what i was looking for! Thank you all for the answers! Edited June 25, 2020 by careca Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Nine Posted June 25, 2020 Share Posted June 25, 2020 2 hours ago, careca said: this was what i was looking for! Great, also, you can use _GUICtrlListView_MapIndexToID if the controls were created with non-native functions (_GUICtrlListView_AddItem and _GUICtrlListView_SubAddItem) careca 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
careca Posted June 25, 2020 Author Share Posted June 25, 2020 If i may ask, how did you come up with this for GUICtrlSetBkColor? I ask because i didn't notice that _GUICtrlListView_GetItemParam() retrieves a control id, instead it says: "Returns the application specific value." I would never make the logical jump into expecting a control id out of it. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Nine Posted June 25, 2020 Share Posted June 25, 2020 In help file, in example of _GUICtrlListView_GetItemParam, there is a comment saying : ; Warning do not use SetItemParam on items created with GUICtrlCreateListViewItem ; Param is the controlID for items created with built-in function Always in help file, now with _GUICtrlListView_SetItemParam, remarks says : Quote As AutoIt uses the $iParam parameter to store the controlID of native-created ListView items, this value should be set sufficiently high for UDF-created items to avoid possible conflict with any existing controls - a starting value of 1000 is recommended. careca 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now