Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21243

API Function SendMessageLong in Windows 7 doesn't work

$
0
0
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 ....
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

Thank you in advance.

Viewing all articles
Browse latest Browse all 21243

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>