When exactly is WM_PAINT called? Im trying to create a dialog based slot machine application, but i’ve run into a couple of logical issues. My application will consist of:
- “Spin” Button
- Exit Button
- Three BMP images to display the results of the spin(coin/heart/soldier)
How will i show the final result of the spin using the BMP images? Am i correct in using WM_PAINT to attempt to display the images, how will i refresh the screen each time the user presses the spin button to show the new images? I really appreciate the help!
Dialog boxes normally use
DefDlgProcas the window procedure. You can’t handleWM_PAINTin yourDialogProc(it isn’t a window procedure). You can use your own window procedure with a dialog but that’s probably more trouble than it’s worth.The simplest way to display a bitmap on a dialog is to use a static control with the
SS_BITMAPstyle.You can change the displayed bitmap by sending the
STM_SETIMAGEmessage to the static control. The control will take care of repainting itself with the new bitmap.This is OK if you just want to display the result of a spin, but won’t work very well if you want to animate the spinning of the reels. To handle this you could create your own static control (i.e. a window for each reel) that would display a portion of a reel bitmap.