|
-
May 11th, 2007, 03:32 PM
#1
Thread Starter
Hyperactive Member
[2005] Using SetSysColor API
I want to change the frame color of all windows on a PC using the SetSysColor API. i implemeted the API as shown below but nothign happens. No errors but no color change either. I'm testing this on an XP machine.
vb Code:
Public Declare Function SetSysColors Lib "user32" _
(ByVal nChanges As Integer, _
ByVal lpSysColor As Integer, _
ByVal lpColorValues As Integer) As Boolean
Public Declare Function GetSysColor Lib "user32" _
(ByVal nIndex As Integer) As Integer
Private Const COLOR_ACTIVECAPTION = 2 'Caption of Active Window
Private Const COLOR_INACTIVECAPTION = 3 'Caption of Inactive window
Private Const COLOR_CAPTIONTEXT = 9
Private OriginalActiveColor As Long ' Holds original active title bar color
Private OriginalInactiveColor As Long ' Holds original inactive title bar color
Public Sub InitColors()
OriginalActiveColor = GetSysColor(COLOR_ACTIVECAPTION)
OriginalInactiveColor = GetSysColor(COLOR_INACTIVECAPTION)
End Sub
Public Sub ResetColors() ' Resets the original system colors
SetSysColors(1, COLOR_ACTIVECAPTION, OriginalActiveColor)
SetSysColors(1, COLOR_INACTIVECAPTION, OriginalInactiveColor)
End Sub
Public Sub ChangeColors()
' Change active title bar color to black
SetSysColors(1, COLOR_ACTIVECAPTION, RGB(0, 0, 0))
' Change inactive title bar color to black
SetSysColors(1, COLOR_INACTIVECAPTION, RGB(0, 0, 0))
End Sub
-
May 11th, 2007, 05:03 PM
#2
Re: [2005] Using SetSysColor API
Perhaps this will help?
http://allapi.mentalis.org/apilist/SetSysColors.shtml
You may need to pass the args ByRef like shown in the code examples at the bottom of the linked page.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 11th, 2007, 06:36 PM
#3
Re: [2005] Using SetSysColor API
Also
http://pinvoke.net is a good resource. They have more .net examples than allapi does.
-
May 11th, 2007, 06:42 PM
#4
Re: [2005] Using SetSysColor API
Old habbits die hard. I keep forgetting about pinvoke.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 11th, 2007, 06:58 PM
#5
Re: [2005] Using SetSysColor API
Someday... someday lol
-
May 14th, 2007, 09:23 AM
#6
Thread Starter
Hyperactive Member
Re: [2005] Using SetSysColor API
You may need to pass the args ByRef like shown in the code examples
You were right. I missed the fact that I was passing the arguments byVal versus byRef. I still can't get the window frame bar to change color. I had to fall back and simply change the color of the caption text.
Is there any reason that I can't change the window frame color? If I look in the dispaly properties, the frame color is set to red but all of my frames still appear as blue.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|