Hello guys,
Until now, I have used this function to personalize the progress bar color which shipping with Microsoft Windows Common Controls 6.0 (SP6). Starting with Windows 7 something goes wrong and each time I get a run-time error 13 (Type mismatch). Interesting, the same code worked properly in Vista ....
Thank you in advance.
Until now, I have used this function to personalize the progress bar color which shipping with Microsoft Windows Common Controls 6.0 (SP6). Starting with Windows 7 something goes wrong and each time I get a run-time error 13 (Type mismatch). Interesting, the same code worked properly in Vista ....
Code:
Private Declare Function SendMessageLong Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const PBM_SETBARCOLOR As Long = (&H400 + 9) 'fore-color
Private Const PBM_SETBKCOLOR As Long = (&H2000 + 1) 'back-color
Public Sub ChangePbColor(ByRef OBJ_progressBar As ProgressBar, ByVal setForeColor As Long, ByVal setBackColor As Long)
Call SendMessageLong(OBJ_progressBar.hwnd, PBM_SETBARCOLOR, 0&, ByVal setForeColor) 'progressbar fore-color
Call SendMessageLong(OBJ_progressBar.hwnd, PBM_SETBKCOLOR, 0&, ByVal setBackColor) 'progressbar back-color
End Sub