CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 1999
    Posts
    2

    can anyone help?



    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.

    [email protected]

  2. #2
    Join Date
    Apr 1999
    Posts
    191

    What do you have so far?



    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.

  3. #3
    Join Date
    Mar 1999
    Posts
    2

    Re: can anyone help?



    no idea where to start, got no help from several books...majorly stuffed!

    Ads.

  4. #4
    Join Date
    Mar 1999
    Location
    ann arbor, Michigan, USA
    Posts
    106

    some help may be!



    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.


    [email protected]

  5. #5
    Join Date
    Apr 1999
    Posts
    6

    Re: can anyone help?



    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++;



    }

  6. #6
    Join Date
    May 1999
    Location
    Oregon, USA
    Posts
    302

    Re: can anyone help?



    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



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured