Tutorial: how to create flash slideshow from JPG images using SWF SlideShow Scout library in Visual C++ - ByteScout

Tutorial: how to create flash slideshow from JPG images using SWF SlideShow Scout library in Visual C++

  • Home
  • /
  • Articles
  • /
  • Tutorial: how to create flash slideshow from JPG images using SWF SlideShow Scout library in Visual C++

 

Making a flash slideshow movie with effects from JPEG images in Visual C++ with SWF SlideShow Scout library

“Hello, World!” example 

You can download the source code of this example here: swfslideshowscout_vc.zip

This tutorial will show how to generate flash slideshow movie with transition effects from JPG images using movie animation SWF SlideShow Scout library in Visual C++

 
1) Install SWF SlideShow Scout library on your computer and run Visual C++
2) Select the “New..” command from “File” menu (as it is shown below) to run  :
File menu in VC IDE
 
3)The  New Project Wizard dialog will appear on the screen. Select “Win32 Console Application” project type and enter “HelloWorld” as the Project name as shown on the screenshot below:
 
VC new project wizard
Set new project name and click OK
 
4) The wizard will ask what kind of Console Application you want to create. Select  A “Hello, World!” application and click Finish:
 
Select new project type
 
VC++ will show the summary information for a new project. Click OK:
 
New project summary
 
Visual C++ will generate the application code for simple console application
 
Source code editor window will appear. To edit main() function just open the class tree on the left and double click on “H elloWorld Classes” | “Globals” | “main (int argc, char* argv[1])“:
 
Main function in code editor
 
VC++ will open main() function: 
 
 
5) To use SWF SlideShow Scout from  VC++ application you have to tell the compiler to import type library information into the project.
 
To import the type library just add #import compiler directive after #include directive:
 
#import “SWFSlideShowScout.tlb”
using namespace SWFSlideShowScout;
 
 
 
 
6) The code snippet that will generate SWF flash animation should be placed in main() function body. 
 
// HelloWorld.cpp : Defines the entry point for the console application.
// 

#include “stdafx.h”

#import “SWFSlideShowScout.tlb”
using namespace SWFSlideShowScout;

int main(int argc, char* argv[])
{
// initialize OLE
HRESULT hr = CoInitialize(NULL);

// check for errors
if (FAILED(hr)) {
MessageBox(0,”OLE initialization errp”,”error”,MB_OK);
return -1;
}
// declare SlideShow object
ISlideShow* SlideShow = NULL;
CLSID clsid;

// get inuque ID for ISlideShow interface
hr = CLSIDFromProgID(OLESTR(“SWFSlideShowScout.SlideShow”), &clsid);
// check for errors
if (FAILED(hr)) {
MessageBox(0,”Can’t get CLSID for interface”,”error”,MB_OK);
goto Uninit;
};
// create SlideShow object
hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL,__uuidof(ISlideShow), (LPVOID*)&SlideShow);
// check for errors
if (FAILED(hr)) {
MessageBox(0,”Can’t create SlideShow object”,”error”,MB_OK);
goto Uninit;
}

// initialize library
SlideShow->InitLibrary(“demo”, “demo”);
// start slideshow movie generation
SlideShow->BeginSlideShow(320,240);

// slide #1, show with “stetMosaicLarge” effect (11 = stetMosaicLarge), 1000 msec
SlideShow->AddSlideFromFileName (“Slide1.jpg”, stetMosaicLarge, 1000);
SlideShow->AddDelay (1000);

// slide #2, show with “stetBlur” effect, 1000 msec
SlideShow->AddSlideFromFileName (“Slide2.jpg”, stetBlur, 1000);
SlideShow->AddDelay (1000);

// slide #3, show with “stetZoomCircle” effect , 1000 msec
SlideShow->AddSlideFromFileName(“Slide3.jpg”, stetZoomCircle, 1000);
SlideShow->AddDelay (1000);

// slide #4, show with “stetLiquid” effect, 1000 msec
SlideShow->AddSlideFromFileName(“Slide4.jpg”, stetLiquid, 1000);
SlideShow->AddDelay (1000);

// slide #5, show with “stetShuttersBias” effect, 1000 msec
SlideShow->AddSlideFromFileName(“Slide5.jpg”, stetShuttersBias, 1000);
SlideShow->AddDelay (2000);

// save to file
SlideShow->SaveToFile(“HelloWorld.swf”);

// disconnect from library
SlideShow->Release();
// uninitialize OLE libraries
Uninit:
CoUninitialize();
return 0;
}

This c++ code will generate swf slideshow flash animation file that will be saved as “HelloWorld.swf” file
 
Hint: 
 
you can simply copy and paste the code from the sample above into VC++ code editor window.
 
7) Run the application by pressing F5 (or use  “Build” | “Debug” | “Go”)
VC++ will compile and run “Hello, World!” application. It will generate Shapes.swf file on C: disk 
 
You can view generated flash movie (.SWF) using Internet Explorer or another application that is capable of viewing and playing of  flash animations.
 
 
 

You can download the source code of this example here: swfslideshowscout_vc.zip

Tutorials:

prev
next