random picture

This is a discussion on random picture within the Windows Programming forums, part of the Platform Specific Boards category; I have a program in MFC (dialog based) that creates a random number. I have imported 3 pictures (a.bmp, b.bmp, ...

random picture

I have a program in MFC (dialog based) that creates a random number. I have imported 3 pictures (a.bmp, b.bmp, c.bmp). The random number is between 1 and 10. I want to make it so if the random number is 123 or 4 display a, 567 display b, and 8910 display c.

How can i do this?

ALSO

how about a dialog box that can be used as a login that will talk with a mysql server?

I don't know how you have the pictures stored, but if you follow this general idea and have a pointer to the data type that represents the picture, and then points to the right picture based upon the random number, you're set. Alternatively, if you have all of the pictures in an array, instead of dealing with a pointer, set an index value, and then access that element of the array, provided you got a valid index.

As far as talking to a mysql server, what about it? Check the documentation for the mysql SDK.

wasn't really what i was looking for. I made a dialog app in mfc and i want it to display a picture like in the if statement and the switch. I already had that, but how do i make it so that IDC_BITMAP1 is displayed if a=1234 and IDC_BITMAP2 is displayed if b=567 etc.

nope. I imported 3 pictures, with resources named IDB_BITMAP1, 2 and 3 respectively. I created a bitmap display section in the dialog box. I want to make an if/switch statement that will let me display IDB_BITMAP1 in the bitmap section if a==123 or 4, IDB_BITMAP2 is a >4.

I don't do MFC, so I can't help ya with specifics if you're asking an MFC-specific question. I agree with Mike. If you know how to display an image and already have code like what I posted for a random number, then you should be set.