I know some of you are looking for GUI's and some want flash . Despite of the memory issues here is a trick. I can't take all credit this was done via information on the web namely Stephane Bourez and Ladislav Nevery..
In you'r includes
#include <windows.h>
#include <exdisp.h>
#include <mshtmlc.h>
// you will need to use mshtmlc so you need 6.0 or PlatformSDK..
also
#import "PROGID:ShockwaveFlash.ShockwaveFlash" no_namespace raw_interfaces_only
#define MsgLoopWhile(a) while(a) { GetMessage(&msg,0,0,0); DispatchMessage(&msg); }
typedef HRESULT (WINAPI *LPAtlAxWinInit) ();
typedef HRESULT (WINAPI *LPAtlAxGetControl)(HWND hwnd, IUnknown** unk);
then where ever in your main.. you could do
MSG msg={0}; void* init = GetProcAddress(LoadLibrary("atl"),"AtlAxWinInit"); _asm call init;
CreateWindow("AtlAxWin","http://www.screenvader.com/_ROOT.swf",WS_VISIBLE|WS_POPUP,100,100,200,200,0,0,0,0);
to call an swf. or better yet...
LPAtlAxWinInit AtlAxWinInit3 = (LPAtlAxWinInit) GetProcAddress(LoadLibrary("atl"),"AtlAxWinInit"); // Atl.dll v 3.0 is part of the windows
LPAtlAxGetControl AtlAxGetControl3 = (LPAtlAxGetControl)GetProcAddress(LoadLibrary("atl"),"AtlAxGetControl");
MSG msg; HRESULT hr = AtlAxWinInit3();
HWND hwnd = CreateWindow("AtlAxWin","http://www.screenvader.com/_ROOT.swf",WS_VISIBLE|WS_POPUP,100,100,200,200,0,0,0,0);
IUnknown* unkn; hr = AtlAxGetControl3(hwnd,&unkn);
IWebBrowser2* brow; hr = unkn->QueryInterface(__uuidof(IWebBrowser2),(void**)&brow);
IDispatch* disp; MsgLoopWhile( !brow->get_Document(&disp) && !disp ); // Document loading loop
IHTMLDocument2* html; hr = disp->QueryInterface(__uuidof(IHTMLDocument2),(void**)&html);
IHTMLElementCollection* elems; hr = html->get_embeds(&elems); VARIANT id; VariantInit(&id);
MsgLoopWhile( elems && !elems->item(id,id,&disp) && !disp ); // Document parsing loop
IShockwaveFlash* flash=0; hr = disp->QueryInterface(__uuidof(IShockwaveFlash),(void**)&flash);
while (GetMessage(&msg,0,0,0) && flash) {
BSTR val,var=L"MyEvent"; hr = flash->GetVariable(var,&val); // Set this var/s in flash
long frame; hr = flash->CurrentFrame(&frame);
DispatchMessage( &msg);
}
so you can gets vars from flash. Just make sure it put you code in the while (getMessafe... or a link to it. Game->runMain or what ever.
If you want to pass it back you can use this idea..
http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_16184
and just use method SetVariable on flash object.
Lastly transparency..
I have not tried this part but here is the idea..
// create invisible container window
HWND ctrl = CreateWindowEx(0,"AtlAxWin",0,0,0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),0,0,0,0);
IShockwaveFlash* flash=0; hr = CoCreateInstance(__uuidof(ShockwaveFlash),0,CLSCTX_ALL, __uuidof(IShockwaveFlash), (void **)&flash);
hr = flash->put_WMode(L"transparent");
hr = AtlAxAttachControl(flash,ctrl,0);
IViewObjectEx* view=0; hr = flash->QueryInterface(__uuidof(IViewObjectEx),(void **)&view);
hr = flash->put_Movie(L"c:WINDOWSHelpToursmmToursegment2.swf");
...
// In msg loop update background and render (to 2nd visible window)
hr = view->Draw(DVASPECT_CONTENT, 0, 0, 0, 0, GetDC(hwnd), 0, 0, 0, 0);
Bigest trouble I have right now is how slow it runs..
If any one has a chance to try this let me know. Maybe its my system that runs so slow. Or if anyone has better understanding of windows calls jump right in..