How to slide show in c

#include "highgui.h"
#include <windows.h>

#include <conio.h>

void findFilesInDirectory();
void showTheImage(const char *imageName);

//for window reDesktopResolution to show image in full screen
int main(  )
{
 findFilesInDirectory();

  return 0;
}


void findFilesInDirectory(){
                      
  HANDLE hFind;
    //Contains information about the file that is found by the FindFirstFile, FindFirstFileEx, or FindNextFile function.
    WIN32_FIND_DATA FindData;
    //http://msdn.microsoft.com/en-us/library/windows/desktop/aa365740(v=vs.85).aspx

    puts("Finding Image Files In Current Directory....");

    // Find the first file
//Searches a directory for a file or subdirectory with a name that matches a specific name (or partial name if wildcards are used).
//list all jpg files
    hFind = FindFirstFile("*.jpg", &FindData);
     puts(FindData.cFileName);

    // Look for more
//Continues a file search from a previous call to the FindFirstFile
    while (FindNextFile(hFind, &FindData))
    {
        puts(FindData.cFileName);
        //when image is found show it
        showTheImage(FindData.cFileName);
    }

    // Close the file handle

    FindClose(hFind);                     






void showTheImage(const char *imageName){
    
int iscolor =1;
int secondsToWait=3000;
IplImage* img = cvLoadImage( imageName ,1);
cvNamedWindow( "Slide Show", CV_WINDOW_AUTOSIZE );
cvShowImage( "Slide Show", img );
cvWaitKey(secondsToWait);
cvReleaseImage( &img );
cvDestroyWindow( "Slide Show" );


}