Home

SWF Scout

SWF Scout screenshot (click to enlarge)



SWF Scout ActiveX/NET library

Using WinGDI functions and .hDC emulation in SWF Scout to draw flash animations using WinGDI functions

This example demonstrates how to use existing WinGDI code to convert it into flash animations using .hDC emulation in SWF Scout

Download source code of this example: swfscout_VC_using HDC_with_WinGDI.zip (30KB)

Produced flash movie (HelloWorld_WithhDC.swf):

Source code (helloworld.cpp, Visual C++):

// 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;
}

// initialize library
Movie->InitLibrary("demo", "demo");

// 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;
}

Download source code of this example: swfscout_avi_to_swf.zip (200KB)

See also: adding PNG image (visual c++ source code) - swfscout_add_png_visual_c.zip (100 KB)


Products  |  Download  |  Purchase  |  Support  |  Contacts  |  Testimonials  |  News |  

ByteScout, 2003-2008. All other company and product names may be trademarks of their respective companies. Privacy Statement