943,844 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 4280
  • C++ RSS
Apr 21st, 2004
0

Refreshing a window

Expand Post »
hi i have a win32 c program. in it there are a few buttons and i am trying to get the program to display a differnet bitmap, for each button. Now i have managed to change the bitmap with this

case ID_STUFF_SMALLKEY:
image = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_SMALL));
if(image == NULL)
MessageBox(hwnd, "Could not load IDB_SMALL!", "Error", MB_OK | MB_ICONEXCLAMATION);

break;
case ID_STUFF_MEDIUMKEY:
image = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_MEDIUM));
if(image == NULL)
MessageBox(hwnd, "Could not load IDB_MEDIUM!", "Error", MB_OK | MB_ICONEXCLAMATION);
break;

but the window needs resizing or minimized and reopended inorder to see the change, is there anywya of forcing the window to repaint the window as the buttons are pressed? Or a better way of implementing what i am trying to do?

i tried putting

UpdateWindow(hwnd);

within it but that did not work.

Thanks for your help.
Keir
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
keir.whitlock is offline Offline
11 posts
since Apr 2004
Apr 21st, 2004
0

Re: Refreshing a window

its ok i have sorted it with the

InvalidateRect (hwnd, NULL, FALSE);

function, forceing the program to re-paint the window. cool
Reputation Points: 10
Solved Threads: 0
Newbie Poster
keir.whitlock is offline Offline
11 posts
since Apr 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Simple IRC Connection
Next Thread in C++ Forum Timeline: How to develop a new program





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC