// HelloWorld.cpp
: Defines the entry point for the console application.
//
#include "stdafx.h"
#import "SWFScout.tlb"
using namespace SWFScout;
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 SWFScout object
IFlashMovie* Movie = NULL;
long Shape, Font, Text;
CLSID clsid;
// get inuque ID for IFlashMovie interface
hr = CLSIDFromProgID(OLESTR("SWFScout.FlashMovie"), &clsid);
// check for errors
if (FAILED(hr)) {
MessageBox(0,"Can't get CLSID for interface","error",MB_OK);
goto Uninit;
};
// create FlashMovie object
hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL,__uuidof(IFlashMovie),
(LPVOID*)&Movie);
// check for errors
if (FAILED(hr)) {
MessageBox(0,"Can't create Movie object","error",MB_OK);
goto Uninit;
}
// start movie generation
Movie->BeginMovie(0,0,640,480,sscTwips, 12,6);
// drawing on a rectangle via WinAPI GDI functions
RECT rRect;
rRect.top = 0; rRect.left= 0; rRect.right= 640; rRect.bottom=480;
long SymbolsCount = 42; // number of symbols in "Hello! Test
using .hDC and WinGDI's DrawText" string
DrawText((HDC)Movie->HDC,"Hello! Test using .hDC and WinGDI
DrawText",SymbolsCount,&rRect,DT_CENTER);
Movie->PlaceFromHDC(Movie->CurrentMaxDepth); // place shape
into current depth
Movie->ShowFrame(1); // show 10 frames
Movie->EndMovie(); // end movie generation
Movie->SaveToFile("c:\\HelloWorld_WithhDC.swf"); //
save generated SWF into file
// disconnect from library
Movie->Release();
// uninitialize OLE libraries
Uninit:
CoUninitialize();
return 0;
}