Windows programming

Moderators: None (Apply to moderate this forum)
Number of threads: 3711
Number of posts: 9173

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
.bmp buttons Posted by Orcblood on 20 Jan 2003 at 3:14 PM
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.

      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);


orcblood
Report
Re: .bmp buttons Posted by AsmGuru62 on 21 Jan 2003 at 8:01 AM
: 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.
:
:
:       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);

:
: orcblood
:
In addition to BS_PUSHBUTTON use BS_BITMAP style. Apply the image with BM_SETIMAGE message to newly created HWND of your button.
Report
Re: .bmp buttons Posted by Orcblood on 21 Jan 2003 at 1:12 PM
This message was edited by Orcblood at 2003-1-21 13:16:24

: : 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.
: :
: :
: :       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);

: :
: : orcblood
: :
: In addition to BS_PUSHBUTTON use BS_BITMAP style. Apply the image with BM_SETIMAGE message to newly created HWND of your button.
:

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

orcblood
Report
Re: .bmp buttons Posted by AsmGuru62 on 22 Jan 2003 at 7:53 AM
: This message was edited by Orcblood at 2003-1-21 13:16:24

: : : 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.
: : :
: : :
: : :       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);

: : :
: : : orcblood
: : :
: : In addition to BS_PUSHBUTTON use BS_BITMAP style. Apply the image with BM_SETIMAGE message to newly created HWND of your button.
: :
:
: Would the BM_SETIMAGE go where I've declaired the buttons the
HWND hButtonNewGame, hButtonLoadGame, hButtonOptions
? How would I code this too - I've never dealed with Bitmaps in windows coding too much before....
:
: orcblood
:
HWND hBtn = CreateWindow (...);
HBITMAP hBmp = LoadBitmap (hInstance, MAKEINTRESOURCE (IDB_YOURIMAGE));

SendMessage (hBtn, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hBmp);




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.