KaFu Posted May 26, 2022 Share Posted May 26, 2022 (edited) This works for me, resulting array contains hWnd and PID to chose from. #include <Array.au3> #include <WinAPI.au3> $a_hWnd_Chrome = WinList("[Class:Chrome_WidgetWin_1]") If $a_hWnd_Chrome[0][0] = 0 Then Exit 123 ; no chrome window found ReDim $a_hWnd_Chrome[UBound($a_hWnd_Chrome)][3] For $i = 1 To $a_hWnd_Chrome[0][0] $a_hWnd_Chrome[$i][2] = WinGetProcess($a_hWnd_Chrome[$i][1]) Next For $i = 32512 To 32518 ; $IDI_APPLICATION to $IDI_SHIELD as defined in AutoItConstants.au3 $hIcon = _WinAPI_LoadIconWithScaleDown(0, $i, 16, 16) $hIcon_orig = _SendMessage($a_hWnd_Chrome[1][1], 0x0080, 1, $hIcon) ; WM_SETICON = 0x0080 _WinAPI_DestroyIcon($hIcon_orig) Sleep(500) Next _ArrayDisplay($a_hWnd_Chrome) P.S.: It seems that the chrome windows all share the same host process, so you'll have to chose by window hwnd or title. Maybe track which hwnd exist and chose different icon for new hwnds? Edited May 27, 2022 by KaFu Jemboy 1 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Jemboy Posted June 3, 2022 Author Share Posted June 3, 2022 @KaFuCame to the same conclusion. And without analyzing you code , I came up with the same idea of using Winlist 😀 For the time being this solution is working for me. Alas, wrote I was using Chrome, but actually I was using Chromedriver which starts an instance of Chrome. I have ask the question in DanP2's Webdriver thread, if it's possibe to obtain the PID or WInHandle direcly from the webdriver when it starts the browser. 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