CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 2001
    Location
    maharashtra,india
    Posts
    181

    const value for PBM_SETBKCOLOR

    i need const value for PBM_SETBKCOLOR

    and is there any way i myself can get its value
    apart from writing a small prog. in vc++
    i tried it but i failed

  2. #2
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    263
    Code:
    Private Const CCM_FIRST As Long = &H2000
    Private Const CCM_SETBKCOLOR As Long = (CCM_FIRST + 1)
    Private Const PBM_SETBKCOLOR As Long = CCM_SETBKCOLOR
    or in simple terms it's value is 8193
    string Signature = Censored;

  3. #3
    Join Date
    Jul 2002
    Location
    England
    Posts
    163
    If you have VC++ installed, all of the declarations are defined in COMMCTRL.H. Do a search for it on your system.

    If you want an easy way to change the colors of a progress bar, you should download my version of it that I made. Its simple, fast and offers a lot more funcitonality thatn the standard Microsoft one. Get it from Planet Source Code. If you do a search for 'FiniteInfinity', you should find it!

    Good luck.
    Finite

    "If a cat always lands on its feet, and a peice of bread always lands butter side down, if you strap a peice of bread butter side up to the back of a cat, will it hover?"

  4. #4
    Join Date
    Apr 2003
    Posts
    1,755

    Smile

    PBM_SETBKCOLOR is 8193. You can get that value without using a VC simple program by using are the commctrl.h file.

    It is defined like this

    #define PBM_SETBKCOLOR CCM_SETBKCOLOR // lParam = bkColor

    so you haave to get the value of CCM_SETBKCOLOR

    #define CCM_SETBKCOLOR (CCM_FIRST + 1) // lParam is bkColor

    again, you have to get the value of CCM_FIRST and add 1

    #define CCM_FIRST 0x2000 // Common control shared messages

    finally we can get 0x2000 + 1 = 0x2001 and this hex value is equal to 8193. You can also use &H2001 to define it.

    Hope it will help you
    Last edited by rxbagain; June 15th, 2003 at 07:34 AM.

  5. #5
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    263
    if you are colouring a progressbar in vb , here's a little code i made a while back to show gow to get started.
    Code:
    Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    
    Private Const WM_USER As Long = &H400
    Private Const CCM_FIRST As Long = &H2000
    Private Const CCM_SETBKCOLOR As Long = (CCM_FIRST + 1)
    Private Const PBM_SETBARCOLOR As Long = (WM_USER + 9)
    
    Public Function ColorBar(prgBar As ProgressBar, Optional BkCol As ColorConstants, Optional FrCol As ColorConstants)
    
    If BkCol = 0 Then BkCol = vbBlue
    If FrCol = 0 Then FrCol = vbRed
    
    SendMessage prgBar.hwnd, CCM_SETBKCOLOR, ByVal 0&, ByVal BkCol
    SendMessage prgBar.hwnd, PBM_SETBARCOLOR, ByVal 0&, ByVal FrCol
    
    End Function
    
    Private Sub Command1_Click()
    ColorBar ProgressBar1, vbBlue, vbRed
    End Sub
    hope this helps.
    string Signature = Censored;

  6. #6
    Join Date
    Jul 2001
    Location
    maharashtra,india
    Posts
    181
    thanx all of u for ur replies

    but i guess as of now i will b using 'FiniteInfinity' progress bar it is really cool & what i always wanted the 'caption'

    rxbagain:
    thanx for ur reply it did really helped me
    one more thing how can i convert that hex value
    sorry for this silly question?

  7. #7
    Join Date
    Jul 2001
    Location
    maharashtra,india
    Posts
    181
    i said, it was really a silly question
    i am sorry i should have searched the forum b4 asking the question. i got the answer
    thanx

  8. #8
    Join Date
    Apr 2003
    Posts
    1,755

    Smile

    You can use your calculator (calc.exe).

    You can also type the hex value in the VB IDE (hex value in a single line alone) and then after typing press the up or down arrow or enter. It will convert the hex to string. For example if you type &H2001 and then press enter, it will automatically replaced with 8193. Just make sure that in that line the only typed is &H2001.

  9. #9
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    263
    you can also use Clng in vb to get the value
    eg: value = Clng(&H2001)
    or to convert to C++ format 0x2001 , and same to convert from C++ format
    eg: 0x0107 would be &H0107
    string Signature = Censored;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured