| View previous topic :: View next topic |
| Author |
Message |
talkerzero Grandmaster Cheater
Reputation: 1
Joined: 24 Jul 2008 Posts: 560 Location: California
|
Posted: Sun Feb 08, 2009 5:10 pm Post subject: [C++ help] Changing the image inside a picture box |
|
|
I'm using a dialog box, made in ResEdit.
To change the text in a label/edit box/etc. you use SetDlgItemText().
How can I change the image inside a picture box? The bitmaps are already embedded into the resource file.
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Feb 08, 2009 5:26 pm Post subject: |
|
|
| you can send it a STM_SETIMAGE message, or just do the drawing yourself.
|
|
| Back to top |
|
 |
talkerzero Grandmaster Cheater
Reputation: 1
Joined: 24 Jul 2008 Posts: 560 Location: California
|
Posted: Sun Feb 08, 2009 11:25 pm Post subject: |
|
|
| Hmm, I tried that and it simply made the image disappear. When sending STM_SETIMAGE, what does the lParam have to be? The HINSTANCE that contains the loaded bitmap, or the HBITMAP that returns a handle to the bitmap?
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Feb 08, 2009 11:34 pm Post subject: |
|
|
| lParam should be a handle to the image, so yes, the HBITMAP
|
|
| Back to top |
|
 |
talkerzero Grandmaster Cheater
Reputation: 1
Joined: 24 Jul 2008 Posts: 560 Location: California
|
Posted: Sun Feb 08, 2009 11:40 pm Post subject: |
|
|
Okay, this is my code.
| Code: | HINSTANCE hInstBItmap;
HBITMAP hOn = LoadBitmap(hInstBitmap, MAKEINTRESOURCE(IDB_BITMAP3));
SendDlgItemMessage(hWnd, IDC_STATUS, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hOn); |
The image just disappears (or, I think maybe it's not "disappearing", it's loading a void image). Help?
Edit: solved my problem, hInstBitmap should have been the hInstance used to make my window. Close thread please.
|
|
| Back to top |
|
 |
|