Leaderboard
Popular Content
Showing content with the highest reputation on 03/17/2019 in all areas
-
Hi! I wrote an UDF that can simplify the way you can control Telegram Bot with AutoIt. If you don't know what is a Telegram Bot, maybe you should read their official website here. All about this UDF is on my GitHub: what is, how it work, how to use and also a Test.au3 to see the script in action. But... let's talk about this UDF. What is: It's an UDF that contain functions to control a Telegram Bot. Send messages, photo, video, stickers, wait for incoming messages and answer to them. How it works: Insert you Token given from BotFather, initialize your bot with _InitBot() function and... you're ready! All functions are commented: You will find a description of what it does, an explanation for every argument that function has need and what it return. This is the test script, that initialize your bot, run all functions and write the return value. #include "Telegram UDF.au3" $ChatID = "Your_Chat_ID_For_Test" _InitBot("Bot_ID","Bot_Token") ConsoleWrite("Test _GetUpdates -> " & @TAB & _GetUpdates() & @CRLF) ConsoleWrite("Test _GetMe -> " & @TAB & _GetMe() & @CRLF) ConsoleWrite("Test _SendMsg -> " & @TAB & _SendMsg($ChatID,"Test _SendMsg") & @CRLF) ConsoleWrite("Test _ForwardMsg -> " & @TAB & _ForwardMsg($ChatID,$ChatID,'MsgID') & @CRLF) ConsoleWrite("Test _SendPhoto -> " & @TAB & _SendPhoto($ChatID,"C:\image.jpg","Test _SendPhoto") & @CRLF) ConsoleWrite("Test _SendVideo -> " & @TAB & _SendVideo($ChatID,"C:\video.mp4","Test _SendVideo") & @CRLF) ConsoleWrite("Test _SendAudio -> " & @TAB & _SendAudio($ChatID,"C:\audio.mp3","Test _SendAudio") & @CRLF) ConsoleWrite("Test _SendDocument -> " & @TAB & _SendDocument($ChatID,"C:\document.txt","Test _SendDocument") & @CRLF) ConsoleWrite("Test _SendVoice -> " & @TAB & _SendVoice($ChatID,"C:\voice.ogg","Test _SendVoice") & @CRLF) ConsoleWrite("Test _SendSticker -> " & @TAB & _SendSticker($ChatID,"C:\sticker.webp") & @CRLF) ConsoleWrite("Test _SendLocation -> " & @TAB & _SendLocation($ChatID,"74.808889","-42.275391") & @CRLF) ConsoleWrite("Test _SendContact -> " & @TAB & _SendContact($ChatID,"0123456789","Josh") & @CRLF) ConsoleWrite("Test _SendChatAction -> " & @TAB & _SendChatAction($ChatID,"typing") & @CRLF) ConsoleWrite("Test _GetUserProfilePhotos -> " & @TAB & _GetUserProfilePhotos($ChatID) & @CRLF) ConsoleWrite("Test _GetChat -> " & @TAB & _GetChat($ChatID) & @CRLF) While 1 $msgData = _Polling() _SendMsg($msgData[2],$msgData[3]) WEnd Last part of the script (While cycle) use Polling function to put the script in a wait-state for incoming messages: _Polling() function return an array ($msgData in this case) that contain information about the received message (for example, $msgData[2] is the Chat ID of the user that send the message, important to send a reply. See GitHub page for other info. So, finally, here you can find and download the library -> https://github.com/xLinkOut/telegram-udf-autoit <- UPDATE: Thanks to @mLipok to added my Telegram UDF on AutoItScript Wiki! UPDATE 2: Functions that send files to Telegram Servers (photos, videos..) don't need anymore cURL executable file. Thanks to @Jos that suggested how to use WinHttp UDF by trancexx. If you have question, bug report or anything else just contact me or reply to this Thread Don't forget to follow me on GitHub for future updates. Bye!1 point
-
The most important update today is the introduction of UIA_SafeArray and UIA_Variant UDFs to be able to handle pattern (action) methods using safearrays as either input or output parameters. The GetCurrentSupportedViews() method of the MultipleView pattern object returns supported views as a safearray of integers. New pattern (action) examples shows how to create UI Automation element arrays and how to traverse these arrays. Other updates: Corrected a few of the usual minor issues I find when doing examples. But this time also a serious error in connection with the Undo/Redo functionality in the Sample code menu. Added cross-references between a few of the Use of UIASpy help pages (the help pages found at the bottom of the main menus and context menus). The cross-references are marked in gray. Double-click to go to the reference documentation. Updated listviews with more yellow cells in second column, indicating that there is an example. New zip-file at bottom of first post.1 point
-
You are probably burning cpu because of your while statement. just use sleep ()1 point
-
Multiple Questions
RestrictedUser reacted to jchd for a topic
Like this: Local $s = "https://www.google.com/something/logo.png?dl=1" Local $grab = StringRegExpReplace($s, ".*\/+(.*)\?.*", "$1") ConsoleWrite($grab & @LF)1 point -
[Solved] Specifying a ControlID Using a Partial String
Zohar reacted to FrancescoDiMuro for a topic
You can use WindowGetClassList(), which returns a list of all the classes related to a Window. Here it is an example1 point -
Multiple Questions
RestrictedUser reacted to water for a topic
You would use function Run to execute WMIC and grab the result by using function StdOutRead. The Net UDF returns the results in an array I assume.1 point -
[Solved] Specifying a ControlID Using a Partial String
Zohar reacted to FrancescoDiMuro for a topic
Use REGEXPCLASS: ControlGetPos("Title", "", "[REGEXPCLASS:(?i)VLC Video Output.*]")1 point -
hWnd and error: Subscript used on non-accessible variable
SkaziChris reacted to Bilgus for a topic
Can't really test it for you but how is this? #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=add_tab_ol_512_swy_icon.ico #AutoIt3Wrapper_Outfile=Citrix_MaintainWindows_v1_x86.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <EditConstants.au3> ; *** End added by AutoIt3Wrapper *** ;#include <ImageSearch.au3> #include <MsgBoxConstants.au3> #include <GUIConstantsEx.au3> #include <GUIEdit.au3> #include <WinAPI.au3> GUISetIcon("add_tab_ol_512_swy_icon.ico") TraySetIcon("add_tab_ol_512_swy_icon.ico") Global $y = 0, $x = 0 Global $temp_x = 0, $temp_y = 0 Global $_hWnd = "null" Global $try = 0 Global $error = "false" Global $msgx = "null" Global $bPaused Global $EditBox1, $EditBox2 Global $monitor1resX = 1680 Global $monitor1resY = 990 Global $monitor2resX = 1280 Global $monitor2resY = 990 Global $currWindowPosX = 0 Global $currWindowPosY = 0 Global $msgtxt HotKeySet("{PAUSE}", "TogglePause") Func TogglePause() $bPaused = Not $bPaused While $bPaused Sleep(100) ToolTip('Script is "Paused = SCRIPT IS NOT RUNNING = you wont get another message if you dont unpause it"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Func Terminate() Exit 0 EndFunc ;==>Terminate Func MoveLeft() Send("{F9}") ;This will move the app to the left screen by an external app (with F9 kb shortcut) ConsoleWrite("Move Left" & @CRLF) Sleep(1000) EndFunc ;==>MoveLeft Func MoveRight() Send("{F10}") ;This will move the app to the left screen by an external app (with F10 kb shortcut) ConsoleWrite("Move Right" & @CRLF) Sleep(1000) EndFunc ;==>MoveRight Func MaintainWindowSize() ; windows that should be put on the LEFT side: ;I'd probably move these global and only update them in another function making them static for now.... Static Local $sLeftWinTitles = "Notepad;Word;Excel;Outlook;Explorer;Chrome;DBInventory;Message ;null" Static Local $aLeft = StringSplit($sLeftWinTitles, ";") ; windows that should be put on the RIGHT side: Static Local $sRightWinTitles = "SQL*Security;Oracle Centralized Security;Putty;Oracle SQL Developer" Static Local $aRight = StringSplit($sRightWinTitles, ";") ; windows classes that should be put on the RIGHT side: Static Local $sRightWinClasses = "TMobaXtermForm;null" Static Local $aRightCL = StringSplit($sRightWinClasses, ";") ; windows classes that should be put on the LEFT side: Static Local $sLeftWinClasses = "ExploreWClass;CabinetWClass;null" Static Local $aLeftCL = StringSplit($sLeftWinClasses, ";") ;;; Static Local $hWnd_Last = 0 ;Save last active Window so we don't check endlessly Local $sTitle, $aWindowSize, $iWidth, $sClass Local $hWnd = WinGetHandle("[ACTIVE]", "") If IsHWnd($hWnd) And $hWnd <> $hWnd_Last Then $hWnd_Last = $hWnd ;WinActivate($hWnd);Probably Not Needed?? $sTitle = WinGetTitle($hWnd) $aWindowSize = WinGetClientSize($hWnd) If @error Or Not IsArray($aWindowSize) Then Return SetError(1, 0, "") $iWidth = $aWindowSize[0] Else Return ;break EndIf ;resolution of the citrix session: 3340x1010 ;each monitor has res 1680x1050 ;so, if the app window has Vsize bigger than 2000, this means it is stretched to more than 1 monitor. ;therefore, position that window to the right monitor... If $iWidth > 2000 Then If IsHWnd($hWnd) Then WinSetState($hWnd, "", @SW_RESTORE) ;$sTitle = WinGetTitle($hWnd);Already have the title $sClass = _WinAPI_GetClassName($hWnd) Else Return ;break EndIf ;MsgBox($MB_SYSTEMMODAL, "", $sClass) If IsArray($aLeft) Then For $i = 1 To $aLeft[0] If StringInStr($sTitle, $aLeft[$i]) Then MoveLeft() EndIf Next Else Return SetError(2, 0, "") EndIf If IsArray($aRight) Then For $j = 1 To $aRight[0] If StringInStr($sTitle, $aRight[$j]) Then MoveRight() EndIf Next Else Return SetError(3, 0, "") EndIf If IsArray($aRightCL) Then For $k = 1 To $aRightCL[0] If StringInStr($sClass, $aRightCL[$k]) Then MoveRight() EndIf Next Else Return SetError(4, 0, "") EndIf If IsArray($aLeftCL) Then For $l = 1 To $aLeftCL[0] If StringInStr($sClass, $aLeftCL[$l]) Then MoveLeft() EndIf Next Else Return SetError(5, 0, "") EndIf EndIf EndFunc ;==>MaintainWindowSize Func Main() Local $iError = 0 While Not $iError ; Try MaintainWindowSize() $iError = @error Sleep(100) WEnd If $iError Then ; Catch MsgBox(0, "Error", $iError) ;MaintainWindowSize() EndIf EndFunc ;==>Main Main()1 point -
Multiple Questions
RestrictedUser reacted to water for a topic
Q1) and Q2): Either use the Account UDF: Or try WMIC: https://www.windows-commandline.com/wmic-useraccounts/ https://superuser.com/questions/344728/list-members-of-a-windows-group-using-command-line https://ss64.com/nt/wmic.html I'm sure there are PowerShell cmdlets available too.1 point -
It is possible with Chrome You just have to elevate Chrome browser to force accessibility #include "UIAWrappers.au3" If Not ProcessExists("chrome.exe") Then $pid = ShellExecute("chrome.exe", "h--e.de") Sleep(500) EndIf $oLogin = _UIA_getFirstObjectOfElement($UIA_oDesktop, "name:=Login - Google Chrome", $treescope_subtree) If Not IsObj($oLogin) Then Exit MsgBox(16 + 262144, Default, "No Login Page found. Press OK to exit.", 0) $oPassword = _UIA_getFirstObjectOfElement($oLogin, "title:=Enter your Id", $treescope_subtree) If Not IsObj($oPassword) Then $pid = ShellExecute("chrome.exe", " about:blank ") Sleep(100) $oBlamk = _UIA_getFirstObjectOfElement($UIA_oDesktop, "name:=about:blank - Google Chrome", $treescope_subtree) Switch @OSLang Case "0407" ; German - Germany $oAddressBar = _UIA_getFirstObjectOfElement($oBlamk, "title:=Adress- und Suchleiste", $treescope_subtree) Case "0409" ; English - United States $oAddressBar = _UIA_getFirstObjectOfElement($oBlamk, "title:=Address and search bar", $treescope_subtree) Case "0413" ; Dutch - Netherlands $oAddressBar = _UIA_getFirstObjectOfElement($oBlamk, "title:=Adres- en zoekbalk", $treescope_subtree) Case "040c" ; French - France $oAddressBar = _UIA_getFirstObjectOfElement($oBlamk, "title:=Barre d'adresse et de recherche", $treescope_subtree) Case "040A" ; Spanish - Spain $oAddressBar = _UIA_getFirstObjectOfElement($oBlamk, "title:=Barra de direcciones y de búsqueda", $treescope_subtree) Case "0410" ; Italian - Italy $oAddressBar = _UIA_getFirstObjectOfElement($oBlamk, "title:=Barra degli indirizzi e di ricerca", $treescope_subtree) Case Else Exit MsgBox(16 + 262144, Default, "Address bar title not found due to unsupported language. Press OK to exit", 0) EndSwitch Sleep(100) _UIA_action($oAddressBar, "setfocus") ;~ chrome://accessibility "--force-renderer-accessibility" _UIA_action($oAddressBar, "setvalue using keys", "chrome://accessibility{ENTER}") $oAccess = _UIA_getFirstObjectOfElement($UIA_oDesktop, "name:=Accessibility Internals - Google Chrome", $treescope_subtree) _UIA_action($oAccess, "setvalue using keys", "{TAB}{Space}{up}{down}{TAB}{TAB}{Space}^w") $oLogin = _UIA_getFirstObjectOfElement($UIA_oDesktop, "name:=Login - Google Chrome", $treescope_subtree) _UIA_action($oLogin, "setfocus") $oPassword = _UIA_getFirstObjectOfElement($oLogin, "title:=Enter your Id", $treescope_subtree) EndIf Sleep(100) _UIA_action($oPassword, "setfocus") _UIA_action($oPassword, "sendkeys", "autoit") Sleep(1000) MsgBox(64 + 262144, Default, "AutoIt index page loaded successful. Press OK to exit and run the script again. It will run faster since the accessability enviroment is already loadad. Don't close the LOGIN window.", 0) _UIA_action($oLogin, "sendkeys", "!{left}") Exit ; End of Script Drop me a note if you need it in another language.1 point
-
GUIListViewEx - BugFix Version 6 Apr 24
argumentum reacted to LarsJ for a topic
I've tested the header color example as 64 bit code on both Windows 7 and Windows 10. In both cases, it fails. There are no colors in the header. Then I've made a much smaller example that only contains header colors: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=y Opt( "MustDeclareVars", 1 ) #include <GUIConstants.au3> #include <GuiListView.au3> Global $hHeader, $aHdrTexts[8] Example() Func Example() ; Create GUI GUICreate( "ListView Header Colors - GUIRegisterMsg", 840, 420 ) ; Create ListView Local $idListView = GUICtrlCreateListView( "", 10, 10, 820, 400 ) _GUICtrlListView_SetExtendedListViewStyle ( $idListView, $LVS_EX_FULLROWSELECT ) ; Add columns to ListView For $i = 0 To 7 _GUICtrlListView_AddColumn( $idListView, "Column " & $i, 99 ) $aHdrTexts[$i] = "Column " & $i Next ; Fill ListView For $i = 0 To 99 GUICtrlCreateListViewItem( $i & "/0|" & $i & "/1|" & $i & "/2|" & $i & "/3|" & _ $i & "/4|" & $i & "/5|" & $i & "/6|" & $i & "/7|", $idListView ) Next ; Header control $hHeader = _GUICtrlListView_GetHeader( $idListView ) ; Register WM_NOTIFY message handler GUIRegisterMsg( 0x004E, "WM_NOTIFY" ) ; 0x004E = $WM_NOTIFY ; Show GUI GUISetState( @SW_SHOW ) ; Message loop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; Cleanup GUIDelete() EndFunc ; WM_NOTIFY message handler Func WM_NOTIFY( $hWnd, $iMsg, $wParam, $lParam ) Local Static $hHdrBrush = _WinAPI_CreateSolidBrush( 0xCCFFFF ) ; Yellow, BGR Local $tNMHDR = DllStructCreate( $tagNMHDR, $lParam ), $hWndFrom = HWnd( DllStructGetData( $tNMHDR, "hWndFrom" ) ), $iCode = DllStructGetData( $tNMHDR, "Code" ) Switch $hWndFrom Case $hHeader Switch $iCode Case $NM_CUSTOMDRAW Local $tNMCustomDraw = DllStructCreate( $tagNMLVCUSTOMDRAW, $lParam ) Local $dwDrawStage = DllStructGetData( $tNMCustomDraw, "dwDrawStage" ) Switch $dwDrawStage ; Holds a value that specifies the drawing stage Case $CDDS_PREPAINT ; Before the paint cycle begins ConsoleWrite( "CDDS_PREPAINT" & @CRLF ) Return $CDRF_NOTIFYITEMDRAW ; Notify parent window of any item related drawing operations Case $CDDS_ITEMPREPAINT ; Before an item is drawn: Default painting (frames and background) ConsoleWrite( "CDDS_ITEMPREPAINT" & @CRLF ) Return $CDRF_NOTIFYPOSTPAINT ; Notify parent window of any post item related drawing operations Case $CDDS_ITEMPOSTPAINT ; After an item is drawn: Custom painting (item texts) ConsoleWrite( "CDDS_ITEMPOSTPAINT" & @CRLF ) Local $iIndex = DllStructGetData( $tNMCustomDraw, "dwItemSpec" ) ; Item index Local $hDC = DllStructGetData( $tNMCustomDraw, "hdc" ) ; Device context _WinAPI_SetBkMode( $hDC, $TRANSPARENT ) ; Transparent background Local $tRECT = DllStructCreate( $tagRECT ) DllStructSetData( $tRECT, 1, DllStructGetData( $tNMCustomDraw, 6 ) + 1 ) DllStructSetData( $tRECT, 2, DllStructGetData( $tNMCustomDraw, 7 ) + 1 ) DllStructSetData( $tRECT, 3, DllStructGetData( $tNMCustomDraw, 8 ) - 2 ) DllStructSetData( $tRECT, 4, DllStructGetData( $tNMCustomDraw, 9 ) - 2 ) _WinAPI_FillRect( $hDC, $tRECT, $hHdrBrush ) ; Background color DllStructSetData( $tNMCustomDraw, "Left", DllStructGetData( $tNMCustomDraw, "Left" ) + 4 ) ; Left margin DllStructSetData( $tNMCustomDraw, "Right", DllStructGetData( $tNMCustomDraw, "Right" ) - 4 ) ; Right margin DllCall( "user32.dll", "int", "DrawTextW", "handle", $hDC, "wstr", $aHdrTexts[$iIndex], "int", StringLen( $aHdrTexts[$iIndex] ), "struct*", DllStructGetPtr( $tNMCustomDraw, "Left" ), "uint", $DT_LEFT+$DT_SINGLELINE+$DT_VCENTER ) ; _WinAPI_DrawText Return $CDRF_NEWFONT ; $CDRF_NEWFONT must be returned after changing font or colors EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG #forceref $hWnd, $iMsg, $wParam EndFunc It fails the same way. Then I've replaced the GUIRegisterMsg technique with the Subclassing technique: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=y Opt( "MustDeclareVars", 1 ) #include <GUIConstants.au3> #include <GuiListView.au3> Global $hHeader, $aHdrTexts[8] Example() Func Example() ; Create GUI GUICreate( "ListView Header Colors - Subclassing", 840, 420 ) ; Create ListView Local $idListView = GUICtrlCreateListView( "", 10, 10, 820, 400 ) _GUICtrlListView_SetExtendedListViewStyle ( $idListView, $LVS_EX_FULLROWSELECT ) Local $hListView = GUICtrlGetHandle( $idListView ) ; Add columns to ListView For $i = 0 To 7 _GUICtrlListView_AddColumn( $idListView, "Column " & $i, 99 ) $aHdrTexts[$i] = "Column " & $i Next ; Fill ListView For $i = 0 To 99 GUICtrlCreateListViewItem( $i & "/0|" & $i & "/1|" & $i & "/2|" & $i & "/3|" & _ $i & "/4|" & $i & "/5|" & $i & "/6|" & $i & "/7|", $idListView ) Next ; Header control $hHeader = _GUICtrlListView_GetHeader( $idListView ) ; Register ListView WM_NOTIFY message handler Local $pLV_WM_NOTIFY = DllCallbackGetPtr( DllCallbackRegister( "LV_WM_NOTIFY", "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr" ) ) DllCall( "comctl32.dll", "bool", "SetWindowSubclass", "hwnd", $hListView, "ptr", $pLV_WM_NOTIFY, "uint_ptr", 0, "dword_ptr", 0 ) ; $iSubclassId = 0, $pData = 0 ;_WinAPI_SetWindowSubclass( $hListView, $pLV_WM_NOTIFY, 0, 0 ) ; $iSubclassId = 0, $pData = 0 ; Show GUI GUISetState( @SW_SHOW ) ; Message loop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; Cleanup DllCall( "comctl32.dll", "bool", "RemoveWindowSubclass", "hwnd", $hListView, "ptr", $pLV_WM_NOTIFY, "uint_ptr", 0 ) ; $iSubclassId = 0 ;_WinAPI_RemoveWindowSubclass( $hListView, $pLV_WM_NOTIFY, 0 ) ; $iSubclassId = 0 GUIDelete() EndFunc ; ListView WM_NOTIFY message handler Func LV_WM_NOTIFY( $hWnd, $iMsg, $wParam, $lParam, $iSubclassId, $pData ) If $iMsg <> 0x004E Then Return DllCall( "comctl32.dll", "lresult", "DefSubclassProc", "hwnd", $hWnd, "uint", $iMsg, "wparam", $wParam, "lparam", $lParam )[0] ; 0x004E = $WM_NOTIFY Local Static $hHdrBrush = _WinAPI_CreateSolidBrush( 0xCCFFFF ) ; Yellow, BGR Local $tNMHDR = DllStructCreate( $tagNMHDR, $lParam ), $hWndFrom = HWnd( DllStructGetData( $tNMHDR, "hWndFrom" ) ), $iCode = DllStructGetData( $tNMHDR, "Code" ) Switch $hWndFrom Case $hHeader Switch $iCode Case $NM_CUSTOMDRAW Local $tNMCustomDraw = DllStructCreate( $tagNMLVCUSTOMDRAW, $lParam ) Local $dwDrawStage = DllStructGetData( $tNMCustomDraw, "dwDrawStage" ) Switch $dwDrawStage ; Holds a value that specifies the drawing stage Case $CDDS_PREPAINT ; Before the paint cycle begins ConsoleWrite( "CDDS_PREPAINT" & @CRLF ) Return $CDRF_NOTIFYITEMDRAW ; Notify parent window of any item related drawing operations Case $CDDS_ITEMPREPAINT ; Before an item is drawn: Default painting (frames and background) ConsoleWrite( "CDDS_ITEMPREPAINT" & @CRLF ) Return $CDRF_NOTIFYPOSTPAINT ; Notify parent window of any post item related drawing operations Case $CDDS_ITEMPOSTPAINT ; After an item is drawn: Custom painting (item texts) ConsoleWrite( "CDDS_ITEMPOSTPAINT" & @CRLF ) Local $iIndex = DllStructGetData( $tNMCustomDraw, "dwItemSpec" ) ; Item index Local $hDC = DllStructGetData( $tNMCustomDraw, "hdc" ) ; Device context _WinAPI_SetBkMode( $hDC, $TRANSPARENT ) ; Transparent background Local $tRECT = DllStructCreate( $tagRECT ) DllStructSetData( $tRECT, 1, DllStructGetData( $tNMCustomDraw, 6 ) + 1 ) DllStructSetData( $tRECT, 2, DllStructGetData( $tNMCustomDraw, 7 ) + 1 ) DllStructSetData( $tRECT, 3, DllStructGetData( $tNMCustomDraw, 8 ) - 2 ) DllStructSetData( $tRECT, 4, DllStructGetData( $tNMCustomDraw, 9 ) - 2 ) _WinAPI_FillRect( $hDC, $tRECT, $hHdrBrush ) ; Background color DllStructSetData( $tNMCustomDraw, "Left", DllStructGetData( $tNMCustomDraw, "Left" ) + 4 ) ; Left margin DllStructSetData( $tNMCustomDraw, "Right", DllStructGetData( $tNMCustomDraw, "Right" ) - 4 ) ; Right margin DllCall( "user32.dll", "int", "DrawTextW", "handle", $hDC, "wstr", $aHdrTexts[$iIndex], "int", StringLen( $aHdrTexts[$iIndex] ), "struct*", DllStructGetPtr( $tNMCustomDraw, "Left" ), "uint", $DT_LEFT+$DT_SINGLELINE+$DT_VCENTER ) ; _WinAPI_DrawText Return $CDRF_NEWFONT ; $CDRF_NEWFONT must be returned after changing font or colors EndSwitch EndSwitch EndSwitch ; Call next function in subclass chain Return DllCall( "comctl32.dll", "lresult", "DefSubclassProc", "hwnd", $hWnd, "uint", $iMsg, "wparam", $wParam, "lparam", $lParam )[0] #forceref $iSubclassId, $pData EndFunc Here the code works in all 4 situations: Windows 7/10, 32/64 bit. In the GUIRegisterMsg example, only CDDS_PREPAINT notifications are displayed in SciTE console. The problem seems to be that the CDRF_NOTIFYITEMDRAW return values are not received by the operating system. Therefore, the operating system does not generate CDDS_ITEMPREPAINT or CDDS_ITEMPOSTPAINT notifications and the header items are not colored. Because the Subclassing example works, it excludes errors in the $tagNMLVCUSTOMDRAW structure. It seems like there is an error in the internal AutoIt code associated with the GUIRegisterMsg function when the code is run as 64 bit code. The return values from the WM_NOTIFY message handler are not properly forwarded to the operating system. The error seems also to be related to the fact that the header control is a second level child in relation to the GUI. Colors does work for a listview control which is a first level child. Solution: Implement the WM_NOTIFY message handler in GUIListViewEx.au3 using the Subclassing technique. This is not necessarily completely trivial. In my example above, it looks easy. But this is also a very small example. Lars.1 point -
borsTiHD, I can reproduce the problem - so it is not just you! It seems to me that the UDF is not returning a valid Device Context handle for the Header when used in x64 mode - but at the moment I have no idea why this happens. I will keep plugging away at the problem. M231 point
-
Listview display one item with bold font?
VAN0 reacted to FrancescoDiMuro for a topic
@VAN0 So it seems.1 point