Click to See Complete Forum and Search --> : can anyone help?
ads
March 30th, 1999, 07:37 AM
hi,
can anyone help me write a program to display several images(bmps) one after the other keeping them on screen for at least 5 seconds?.....they will be called 0_0.bmp........0_1.bmp etc
thankyou.
Ads.
ea250@city.ac.uk
Bore
March 30th, 1999, 07:57 AM
Write something yourself that does this with an easy message box instead of an image, and I'm sure someone here will help you figure out how to display the images.
ads
March 30th, 1999, 08:09 AM
no idea where to start, got no help from several books...majorly stuffed!
Ads.
yalcin
March 30th, 1999, 08:47 AM
first of all you have to be able to read and display a single bmp image.Look in the bitmap section. or even in VC++ samples there are samples called diblook or dib_enhanced etc. The core class in all these samples is a CDib image class. It can read and write dib image to and from a bmp file. It can also display the image once the image is loaded. Accomplishing this first step is easy if you are familiar with VC++. Diblook or Dib_enhanced is basically what you want.
Next I would build the functionality that will cycle through a number of images. May be if you have done the first step, you can come ask about the details of the second step.
My advice is however to try something first before asking. Look at VC++ help files and sample files. Look at Bitmap section of this site. And finally spend a few days at Borders if you can. I have at least 5 books that deals with these with source code.
yalcin@ioflex.com
deep
March 30th, 1999, 08:50 AM
if image names are in sequence , you can use CString array as follows
CString cst[10];
for(i = 0; i < = 9;i++)
cst[i].Format("c:\xyz%d.bmp",i);
i = 0;
SetTimer(1,5000,NULL);
OnTimer()
{
load the images
i++;
}
Gomez Addams
March 30th, 1999, 11:58 AM
Just to expand a bit on deep's suggestion,
build a list or array of images and maintain an
index (for an array) or a pointer (for a list) to
the current image. Then, start a timer to let you
now when to change images. In an OnTimer function
do something like this :
OnTimer( int timerid )
{
if( timerid != MyTimer )
{
// call OnTimer for base class
return;
}
// it was your timer
// advance to next image
// reset to first one if at last
// load new image
Invalidate(); // cause window to be repainted
}
Timers need to be 'owned' by a window or a class derived from
CWnd. Typically this will be your CMainFrame or CView derivation.
Try out one of the libraries from this site's 'bitmaps and palettes'
section. There are about three there. If you are going to stick
with bitmaps, you can start with the enhanced diblook sample from
this site and throw in the timer and the image list and you are
ready to go.
Good Luck
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.