Jump to content

Recommended Posts

Posted

I want to ask if somebody already tried WM_CTLCOLORSCROLLBAR for changing color for ScrollBar ?

Maybe someone already has a ready example?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted

I think it's meant for other random bars that you can create, rather than those attached to a window.

#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

$hGUI = GUICreate("Test", 200, 100, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_HSCROLL, $WS_VSCROLL))
_SBCreate($hGUI, 1000, 10, 10, 100, 20)

GUIRegisterMsg($WM_CTLCOLORSCROLLBAR, "WM_CTLCOLORSCROLLBAR")
GUISetState()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()

Func _SBCreate($hWnd, $idCtrlID, $iX, $iY, $iWidth, $iHeight, $iStyle = -1, $iExStyle = -1)
    If $iStyle = -1 Then $iStyle = BitOR($WS_VISIBLE, $WS_CHILD)
    If $iExStyle = -1 Then $iExStyle = 0
    Return _WinAPI_CreateWindowEx($iExStyle, $WC_SCROLLBAR, "", $iStyle, $iX, $iY, $iWidth, $iHeight, $hWnd, $idCtrlID, _WinAPI_GetModuleHandle(0), 0)
EndFunc

Func WM_CTLCOLORSCROLLBAR($hWnd, $iMsg, $wParam, $lParam)
    Return _WinAPI_GetStockObject($BLACK_BRUSH)
EndFunc

 

Posted (edited)

Little modified

#include <ColorConstants.au3>
#include <GuiConstants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

_Example()
Func _Example()
    Local $hGUI = GUICreate("Test", 400, 200, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_HSCROLL, $WS_VSCROLL))
    GUISetBkColor($COLOR_LIGHTSEAGREEN, $hGUI)
    Local $hScrollBarGUI = _SBCreate($hGUI, 1000, 20, 30, 330, 30)
    #forceref $hScrollBarGUI

    GUIRegisterMsg($WM_CTLCOLORSCROLLBAR, __WM_CTLCOLORSCROLLBAR)
    GUISetState()

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    GUIDelete()


EndFunc   ;==>_Example

Func _SBCreate($hWnd, $idCtrlID, $iX, $iY, $iWidth, $iHeight, $iStyle = -1, $iExStyle = -1)
    If $iStyle = -1 Then $iStyle = BitOR($WS_VISIBLE, $WS_CHILD)
    If $iExStyle = -1 Then $iExStyle = 0
    Return _WinAPI_CreateWindowEx($iExStyle, $WC_SCROLLBAR, "", $iStyle, $iX, $iY, $iWidth, $iHeight, $hWnd, $idCtrlID, _WinAPI_GetModuleHandle(0), 0)
EndFunc   ;==>_SBCreate

Func __WM_CTLCOLORSCROLLBAR($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam, $lParam

;~  Return _WinAPI_GetStockObject($BLACK_BRUSH)
;~  Return _WinAPI_GetStockObject($DKGRAY_BRUSH)
    Return _WinAPI_GetStockObject($GRAY_BRUSH)

;~  Local $tItem = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) ; $tagNMLVCUSTOMDRAW is defined in #include <StructureConstants.au3> ; https://learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-nmlvcustomdraw
;~  Local $hDC = $tItem.hdc                      ; Device context
;~  Return _WinAPI_SetDCBrushColor($hDC, $COLOR_LIGHTBLUE)
EndFunc   ;==>__WM_CTLCOLORSCROLLBAR

I read here:
https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-getstockobject

about:

Quote

 The GetStockObject function with an argument of DC_BRUSH or DC_PEN can be used interchangeably with the SetDCPenColor and SetDCBrushColor functions.

For this reason I was trying to use my specific color like $COLOR_LIGHTBLUE in this part:

Local $tItem = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) ; $tagNMLVCUSTOMDRAW is defined in #include <StructureConstants.au3> ; https://learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-nmlvcustomdraw
    Local $hDC = $tItem.hdc                      ; Device context
    Return _WinAPI_SetDCBrushColor($hDC, $COLOR_LIGHTBLUE)
EndFunc   ;==>__WM_CTLCOLORSCROLLBAR

But with no success :(

Any help please ?

 

EDIT:
also tried this way:

Local Static $hBrush = _WinAPI_CreateSolidBrush($COLOR_AQUA)
    Local $tItem = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) ; $tagNMLVCUSTOMDRAW is defined in #include <StructureConstants.au3> ; https://learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-nmlvcustomdraw
    Local $hDC = $tItem.hdc                      ; Device context
    _WinAPI_SelectObject($hDC, $hBrush)
    Return $CDRF_SKIPDEFAULT
EndFunc   ;==>__WM_CTLCOLORSCROLLBAR

Still with no success :(

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted (edited)

Here is my another approach:

#include <ColorConstants.au3>
#include <GuiConstants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

_Example()
Func _Example()
    Local $hGUI = GUICreate("Test", 400, 200, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_HSCROLL, $WS_VSCROLL))
    GUISetBkColor($COLOR_LIGHTSEAGREEN, $hGUI)
    Local $hScrollBarGUI = _SBCreate($hGUI, 1000, 20, 30, 330, 30)
    #forceref $hScrollBarGUI

;~  GUIRegisterMsg($WM_CTLCOLORSCROLLBAR, __WM_CTLCOLORSCROLLBAR)
    GUISetState()

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    GUIDelete()


EndFunc   ;==>_Example

Func _SBCreate($hWnd, $idCtrlID, $iX, $iY, $iWidth, $iHeight, $iStyle = -1, $iExStyle = $WS_EX_TOPMOST, $bBorder = True)
    If $iStyle = -1 Then $iStyle = BitOR($WS_VISIBLE, $WS_CHILD)
    If $iExStyle = -1 Then $iExStyle = 0
    If $bBorder Then
        Local $idLabel = GUICtrlCreateLabel("", $iX - 2, $iY - 2, $iWidth + 4, $iHeight + 4, $SS_BLACKRECT)
        GUICtrlSetColor($idLabel, $COLOR_LIGHTCORAL)
    EndIf

    Return _WinAPI_CreateWindowEx($iExStyle, $WC_SCROLLBAR, "", $iStyle, $iX, $iY, $iWidth, $iHeight, $hWnd, $idCtrlID, _WinAPI_GetModuleHandle(0), 0)
EndFunc   ;==>_SBCreate

Func __WM_CTLCOLORSCROLLBAR($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam, $lParam

;~  Return _WinAPI_GetStockObject($BLACK_BRUSH)
;~  Return _WinAPI_GetStockObject($DKGRAY_BRUSH)
    Return _WinAPI_GetStockObject($GRAY_BRUSH)

;~  Local $tItem = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) ; $tagNMLVCUSTOMDRAW is defined in #include <StructureConstants.au3> ; https://learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-nmlvcustomdraw
;~  Local $hDC = $tItem.hdc                      ; Device context
;~  Return _WinAPI_SetDCBrushColor($hDC, $COLOR_LIGHTBLUE)
EndFunc   ;==>__WM_CTLCOLORSCROLLBAR

But I see that $WS_EX_TOPMOST is not working as I expected.
I mean I can't click / move the ScrollBar created with _SBCreate() as my $idLabel is cover this scrollbar.
Any body has better / easier way to draw border in specific color for this ScrollBar created with  _SBCreate()  ?
Or just move Z order of the ScrollBar over the Label ?

image.png.f0ceb5ac06dde048f996a1442a55c200.png

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted

Also here are some interesting findings:
https://superuser.com/a/1435181/1049106

about Registry settings:
 

Quote

Computer\HKEY_CURRENT_USER\Control Panel\Colors
Computer\HKEY_CURRENT_USER\Control Panel\Desktop\Colors

also you may want to take a look here:
 

Quote

Computer\HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted (edited)
15 hours ago, mLipok said:

I want to ask if somebody already tried WM_CTLCOLORSCROLLBAR for changing color for ScrollBar ?

I tried to use this last week for scrollbars in GUIDarkTheme UDF by returning the brush color. But unfortunately it does not work for scrollbars that are part of a control (eg. ListView, TreeView, etc.) since they all handle their own scrollbars internally.

Some of the tricks used, such as drawing custom scrollbars over top of existing scrollbars, is probably a bit too complex and resource waste for my purposes.

Regardless, I am going to continue to follow your examples in this thread because I am curious about it.

Edited by WildByDesign
Posted

Also, we can use things like _WinAPI_SetSysColors to set the global system colors for scrollbars and other controls. But the problem in Win10/11 is that they ignore the majority of those values now because some things (scrollbars, menu, etc.) are all done through the theming engine (uxtheme) following values from within the aero.msstyles file.

Posted
15 hours ago, mLipok said:
Quote

 The GetStockObject function with an argument of DC_BRUSH or DC_PEN can be used interchangeably with the SetDCPenColor and SetDCBrushColor functions.

For this reason I was trying to use my specific color like $COLOR_LIGHTBLUE in this part:

Local $tItem = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) ; $tagNMLVCUSTOMDRAW is defined in #include <StructureConstants.au3> ; https://learn.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-nmlvcustomdraw
    Local $hDC = $tItem.hdc                      ; Device context
    Return _WinAPI_SetDCBrushColor($hDC, $COLOR_LIGHTBLUE)
EndFunc   ;==>__WM_CTLCOLORSCROLLBAR

But with no success :(

Any help please ?

A couple of things..

lparam is not a ptr to a NVLMCUSTOMDRAW here. For WM_CTLCOLORSCROLLBAR, the DC is passed to us through wParam.  We also need to return a brush for the background, which SetDCBrushColor doesn't do.

so it should look something like this. 

Func WM_CTLCOLORSCROLLBAR($hWnd, $iMsg, $wParam, $lParam)
    _WinAPI_SetDCBrushColor($wParam, $COLOR_LIGHTBLUE)
    Return _WinAPI_GetStockObject($DC_BRUSH)
EndFunc

But to @WildByDesign's point, this is all academic and doesn't really achieve much.

Posted
On 5/2/2026 at 1:22 PM, mLipok said:

But I see that $WS_EX_TOPMOST is not working as I expected.
I mean I can't click / move the ScrollBar created with _SBCreate() as my $idLabel is cover this scrollbar.
Any body has better / easier way to draw border in specific color for this ScrollBar created with  _SBCreate()  ?
Or just move Z order of the ScrollBar over the Label ?

Any suggestion here ?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted

Thanks This works

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...