Results 1 to 16 of 16

Thread: Wapi

  1. #1

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919

    Wapi

    wow, i decided to learn the windows API instead of using MFC, i picked it up pretty quick...and i like it better than MFC. the widnow creation is abit of a pain in the ass..but i got winsock working

    now for my question..
    i have:
    wcxMain.hbrBackground = (HBRUSH) LTGRAY_BRUSH;

    i can't figure out the "normal" gray background color, either i get too light or too dark. ive tried out all the constants listed..any idea?
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  2. #2
    Member
    Join Date
    Jun 2002
    Posts
    46
    As far as I know windows only defines six brushes these are:

    WHITE_BRUSH
    BLACK_BRUSH
    GRAY_BRUSH
    LTGRAY_BRUSH
    DKGRAY_BRUSH
    NULL_BRUSH

    If you need any other colours you will need to create your own.

    Code:
    HBRUSH hBrush = NULL;
    hdc = BeginPaint(hwnd, &ps);
    hBrush = CreateSolidBrush(RGB(0,255,0);  // Create solid green brush
    SelectObject (hdc, hBrush);
    EndPaint(hwnd, &ps);
    DeleteObject (hBrush) ;
    Don't forget to delete the brush once your finished with it to avoid a resource leak.
    ISquishWorms

  3. #3

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    Oh ok..thanks. Do you know maybe where I can get the RPG values for normal window?
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  4. #4
    Member
    Join Date
    Jun 2002
    Posts
    46
    There are however several system colours that windows uses you could try this. I think that the system colours can be changed by users using windows settings not sure though, just keep that in mind.

    Code:
    hBrush = CreateSolidBrush (GetSysColor(COLOR_APPWORKSPACE));
    or
    Code:
    hBrush = CreateSolidBrush (GetSysColor(COLOR_BACKGROUND));
    COLOR_BACKGROUND = RGB(00,80,80)
    COLOR_APPWORKSPACE = RGB(80,80,80)
    Last edited by ISquishWorms; Nov 7th, 2002 at 09:56 PM.
    ISquishWorms

  5. #5

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    Yeah I was about to post I tried those too, heres the ones:

    COLOR_ACTIVEBORDER
    COLOR_ACTIVECAPTION
    COLOR_APPWORKSPACE
    COLOR_BACKGROUND
    COLOR_BTNFACE
    COLOR_BTNSHADOW
    COLOR_BTNTEXT
    COLOR_CAPTIONTEXT
    COLOR_GRAYTEXT
    COLOR_HIGHLIGHT
    COLOR_HIGHLIGHTTEXT
    COLOR_INACTIVEBORDER
    COLOR_INACTIVECAPTION
    COLOR_MENU
    COLOR_MENUTEXT
    COLOR_SCROLLBAR
    COLOR_WINDOW
    COLOR_WINDOWFRAME
    COLOR_WINDOWTEXT


    None of them are the right color...either too light or dark

    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    When using the constants
    WHITE_BRUSH
    BLACK_BRUSH
    GRAY_BRUSH
    LTGRAY_BRUSH
    DKGRAY_BRUSH
    NULL_BRUSH
    you have to do
    wcxMain.hbrBackground = (HBRUSH)GetStockObject(constant);

    When using the COLOR_* constants you have to do
    wcxMain.hbrBackground = (HBRUSH)(COLOR_* + 1);
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7
    Member
    Join Date
    Jun 2002
    Posts
    46
    Nabeels786, you should feel privileged you have one of the experts around here helping you now. I tried to help but CornedBee will probably be able to give you the answer that you seek (he’s pretty clever you know). He helps me a lot.
    Last edited by ISquishWorms; Nov 8th, 2002 at 08:46 AM.
    ISquishWorms

  8. #8
    Addicted Member HairyDave's Avatar
    Join Date
    Aug 2002
    Location
    Er...I can't remember.
    Posts
    196
    And me quite a few times. I try my best, but these youngsters seem to know what they're doing better than me

    HD

  9. #9
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Talking

    On the downside, I don't have a life
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  10. #10

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    Originally posted by CornedBee
    When using the constants
    WHITE_BRUSH
    BLACK_BRUSH
    GRAY_BRUSH
    LTGRAY_BRUSH
    DKGRAY_BRUSH
    NULL_BRUSH
    you have to do
    wcxMain.hbrBackground = (HBRUSH)GetStockObject(constant);

    When using the COLOR_* constants you have to do
    wcxMain.hbrBackground = (HBRUSH)(COLOR_* + 1);
    Yeah I got those working, but I can't seem to find the correct shade of gray

    Thanks for helping all I guess I'll just go with my lighter gray background, doesn't matter all too much anyway
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  11. #11
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    You want COLOR_BTNFACE. That gives the standard background grey colour.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  12. #12

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    Originally posted by parksie
    You want COLOR_BTNFACE. That gives the standard background grey colour.
    I tried that, I get black
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  13. #13
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Uh. Hmm. Try COLOR_BTNFACE + 1.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  14. #14
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    A rather dark shadde of grey would be (COLOR_APPWORKSPACE + 1), which is the background color of MDI windows.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  15. #15
    Member
    Join Date
    Jun 2002
    Posts
    46
    Looks to me like you now have two experts trying to help you out.
    ISquishWorms

  16. #16

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    Originally posted by parksie
    Uh. Hmm. Try COLOR_BTNFACE + 1.
    I still got black


    COLOR_APPWORKSPACE + 1 worked. Thanks guys
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

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