Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

.bmp buttons

I was wondering how to create a bitmap button... I know it might be a hard task but I want to use custom .bmp images for a little game project that Im working on... I have the following code, but I don't know how to use a bitmap file for a button... Anyways, if some one could tell me how to create the bitmap button or just re-write my code then I would love the help!

Ps, I have the .bmp in my resource files - I can recreate it so that its 16 million colours if nessessary.

[code]
hButtonNewGame =
CreateWindow("BUTTON", "New Game",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 150, 130, 80, 20,
hwnd,(HMENU) 1, hInstGlobal, NULL);
hButtonLoadGame =
CreateWindow("BUTTON", "Load Game",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 150, 160, 80, 20,
hwnd,(HMENU) 2, hInstGlobal, NULL);
hButtonOptions =
CreateWindow("BUTTON", "Options",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 150, 190, 80, 20,
hwnd,(HMENU) 1, hInstGlobal, NULL);[/code]

orcblood

Comments

  • AsmGuru62AsmGuru62 Posts: 6,519Member
    : I was wondering how to create a bitmap button... I know it might be a hard task but I want to use custom .bmp images for a little game project that Im working on... I have the following code, but I don't know how to use a bitmap file for a button... Anyways, if some one could tell me how to create the bitmap button or just re-write my code then I would love the help!
    :
    : Ps, I have the .bmp in my resource files - I can recreate it so that its 16 million colours if nessessary.
    :
    : [code]
    : hButtonNewGame =
    : CreateWindow("BUTTON", "New Game",
    : WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 150, 130, 80, 20,
    : hwnd,(HMENU) 1, hInstGlobal, NULL);
    : hButtonLoadGame =
    : CreateWindow("BUTTON", "Load Game",
    : WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 150, 160, 80, 20,
    : hwnd,(HMENU) 2, hInstGlobal, NULL);
    : hButtonOptions =
    : CreateWindow("BUTTON", "Options",
    : WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 150, 190, 80, 20,
    : hwnd,(HMENU) 1, hInstGlobal, NULL);[/code]
    :
    : orcblood
    :
    [blue]In addition to [b]BS_PUSHBUTTON[/b] use [b]BS_BITMAP[/b] style. Apply the image with [b]BM_SETIMAGE[/b] message to newly created [b]HWND[/b] of your button.[/blue]
  • OrcbloodOrcblood Posts: 44Member
    [b][red]This message was edited by Orcblood at 2003-1-21 13:16:24[/red][/b][hr]
    : : I was wondering how to create a bitmap button... I know it might be a hard task but I want to use custom .bmp images for a little game project that Im working on... I have the following code, but I don't know how to use a bitmap file for a button... Anyways, if some one could tell me how to create the bitmap button or just re-write my code then I would love the help!
    : :
    : : Ps, I have the .bmp in my resource files - I can recreate it so that its 16 million colours if nessessary.
    : :
    : : [code]
    : : hButtonNewGame =
    : : CreateWindow("BUTTON", "New Game",
    : : WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 150, 130, 80, 20,
    : : hwnd,(HMENU) 1, hInstGlobal, NULL);
    : : hButtonLoadGame =
    : : CreateWindow("BUTTON", "Load Game",
    : : WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 150, 160, 80, 20,
    : : hwnd,(HMENU) 2, hInstGlobal, NULL);
    : : hButtonOptions =
    : : CreateWindow("BUTTON", "Options",
    : : WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 150, 190, 80, 20,
    : : hwnd,(HMENU) 1, hInstGlobal, NULL);[/code]
    : :
    : : orcblood
    : :
    : [blue]In addition to [b]BS_PUSHBUTTON[/b] use [b]BS_BITMAP[/b] style. Apply the image with [b]BM_SETIMAGE[/b] message to newly created [b]HWND[/b] of your button.[/blue]
    :

    Would the BM_SETIMAGE go where I've declaired the buttons the [code]HWND hButtonNewGame, hButtonLoadGame, hButtonOptions[/code]? How would I code this too - I've never dealed with Bitmaps in windows coding too much before....

    orcblood
  • AsmGuru62AsmGuru62 Posts: 6,519Member
    : [b][red]This message was edited by Orcblood at 2003-1-21 13:16:24[/red][/b][hr]
    : : : I was wondering how to create a bitmap button... I know it might be a hard task but I want to use custom .bmp images for a little game project that Im working on... I have the following code, but I don't know how to use a bitmap file for a button... Anyways, if some one could tell me how to create the bitmap button or just re-write my code then I would love the help!
    : : :
    : : : Ps, I have the .bmp in my resource files - I can recreate it so that its 16 million colours if nessessary.
    : : :
    : : : [code]
    : : : hButtonNewGame =
    : : : CreateWindow("BUTTON", "New Game",
    : : : WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 150, 130, 80, 20,
    : : : hwnd,(HMENU) 1, hInstGlobal, NULL);
    : : : hButtonLoadGame =
    : : : CreateWindow("BUTTON", "Load Game",
    : : : WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 150, 160, 80, 20,
    : : : hwnd,(HMENU) 2, hInstGlobal, NULL);
    : : : hButtonOptions =
    : : : CreateWindow("BUTTON", "Options",
    : : : WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 150, 190, 80, 20,
    : : : hwnd,(HMENU) 1, hInstGlobal, NULL);[/code]
    : : :
    : : : orcblood
    : : :
    : : [blue]In addition to [b]BS_PUSHBUTTON[/b] use [b]BS_BITMAP[/b] style. Apply the image with [b]BM_SETIMAGE[/b] message to newly created [b]HWND[/b] of your button.[/blue]
    : :
    :
    : Would the BM_SETIMAGE go where I've declaired the buttons the [code]HWND hButtonNewGame, hButtonLoadGame, hButtonOptions[/code]? How would I code this too - I've never dealed with Bitmaps in windows coding too much before....
    :
    : orcblood
    :
    [code]
    HWND hBtn = CreateWindow (...);
    HBITMAP hBmp = LoadBitmap (hInstance, MAKEINTRESOURCE (IDB_YOURIMAGE));

    SendMessage (hBtn, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hBmp);
    [/code]
Sign In or Register to comment.