-
Mar 1st, 2005, 03:06 PM
#1
Thread Starter
Lively Member
[VB6] Progress bar color?
Can you change the color of the progress bar?
Thanks
Last edited by ChaosBlizzard; Mar 1st, 2005 at 07:59 PM.
-
Mar 1st, 2005, 03:21 PM
#2
Fanatic Member
Re: [VB6] Progress bar color?
This one can. I use it in a couple app's, it works very well.
http://www.smartdownloads.net/download-22208.html
Here's to us!
Who's like us?
Darned few, and they're all dead!
-
Mar 1st, 2005, 03:28 PM
#3
Re: [VB6] Progress bar color?
No purchase of a control needed.
VB Code:
'<VBOutlookGuru 05/30/03 - CHANGE PROGRESSBAR COLOR>
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const PBM_SETBARCOLOR As Long = &H409
Private Const PBM_SETBKCOLOR As Long = &H2001
Private Const PROGBAR_DEF_COLOR = &HFF000000 '&H8000000D
'Usage -
Call SendMessageLong(ProgressBar1.hwnd, PBM_SETBARCOLOR, 0&, ByVal 255) 'Red
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
-
Mar 1st, 2005, 03:31 PM
#4
Fanatic Member
Re: [VB6] Progress bar color?
Oh, didn't see he's charging for it now. It's a good control that allows lots of features for the progress bar if you have the extra 20 bucks or whatever. But, looks like robdogg's method is the cheap way.
Here's to us!
Who's like us?
Darned few, and they're all dead!
-
Mar 1st, 2005, 03:36 PM
#5
Thread Starter
Lively Member
Re: [VB6] Progress bar color?
Originally Posted by RobDog888
No purchase of a control needed.
VB Code:
'<VBOutlookGuru 05/30/03 - CHANGE PROGRESSBAR COLOR>
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const PBM_SETBARCOLOR As Long = &H409
Private Const PBM_SETBKCOLOR As Long = &H2001
Private Const PROGBAR_DEF_COLOR = &HFF000000 '&H8000000D
'Usage -
Call SendMessageLong(ProgressBar1.hwnd, PBM_SETBARCOLOR, 0&, ByVal 255) 'Red
That looks better that most other color changing codes.. But it sends off an error stating that ProgressBar1.hwnd is an invalid procedure in this line:
Call SendMessageLong(ProgressBar1.hwnd, PBM_SETBARCOLOR, 0&, ByVal 255)
-
Mar 1st, 2005, 03:38 PM
#6
Fanatic Member
Re: [VB6] Progress bar color?
Put that line in a command button, or wherever you want it to run from, not with the declarations.
Here's to us!
Who's like us?
Darned few, and they're all dead!
-
Mar 1st, 2005, 04:17 PM
#7
Re: [VB6] Progress bar color?
Here is a working example.
VB Code:
'Behind form1
Option Explicit
'Add one progressbar to your form (ProgressBar1)
'Add two command buttons (Command1 & Command2)
'<VBOutlookGuru 05/30/03 - CHANGE PROGRESSBAR COLOR>
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const PBM_SETBARCOLOR As Long = &H409
Private Const PBM_SETBKCOLOR As Long = &H2001
Private Const PROGBAR_DEF_COLOR = &HFF000000 '&H8000000D
Private sub form_Load()
Progressbar1.max = 100
Progressbar1.value = 50
End Sub
Private sub Command1_Click() 'Changes the prb to red
Call SendMessageLong(ProgressBar1.hwnd, PBM_SETBARCOLOR, 0&, ByVal 255) 'Red
End Sub
Private Sub COmmand2_Click() 'Changes it back to system default
Call SendMessageLong(ProgressBar1.hwnd, PBM_SETBARCOLOR, 0&, ByVal PROGBAR_DEF_COLOR) 'Default system color
End Sub
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
-
Mar 1st, 2005, 06:21 PM
#8
Thread Starter
Lively Member
Re: [VB6] Progress bar color?
That codes for a progress bar that changes color when you click a button?.
I just wanted to change it period, you know have a static color. I don't need anything interactive.
-
Mar 1st, 2005, 06:25 PM
#9
Re: [VB6] Progress bar color?
Errr...
Code:
Option Explicit
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const PBM_SETBARCOLOR As Long = &H409
Private Const PBM_SETBKCOLOR As Long = &H2001
Private Const PROGBAR_DEF_COLOR = &HFF000000 '&H8000000D
Private sub Form_Load()
Progressbar1.max = 100
Progressbar1.value = 50
ChangeColorOfProgBar
End Sub
Private sub ChangeColorOfProgBar
Call SendMessageLong(ProgressBar1.hwnd, PBM_SETBARCOLOR, 0&, ByVal 255) 'Red
End Sub
Woof
-
Mar 1st, 2005, 06:32 PM
#10
Thread Starter
Lively Member
Re: [VB6] Progress bar color?
Hey that works! LOL
Sorry and thanks!
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
|