// // Flash ‹ì“®ƒeƒXƒg // #include #include CComModule _Module; #include #import "c:\WINDOWS\system32\macromed\flash\Flash.ocx" rename_namespace("Flash") named_guids class CMyWindow : public CWindowImpl { BEGIN_MSG_MAP(CMyWindow) MESSAGE_HANDLER(WM_DESTROY, OnDestroy) END_MSG_MAP() LRESULT OnDestroy(UINT, WPARAM, LPARAM, BOOL&){ PostQuitMessage(0); return 0; } }; int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { int ret; _Module.Init(NULL, hInstance); AtlAxWinInit(); CMyWindow wnd; wnd.Create(NULL, CWindow::rcDefault, NULL, WS_OVERLAPPEDWINDOW|WS_VISIBLE); Flash::IShockwaveFlash *flash; LPOLESTR pstrCLSID_ShockwaveFlash = NULL; StringFromCLSID(Flash::CLSID_ShockwaveFlash, &pstrCLSID_ShockwaveFlash); HRESULT hr = wnd.CreateControl(pstrCLSID_ShockwaveFlash); CoTaskMemFree(pstrCLSID_ShockwaveFlash); if (FAILED(hr) || FAILED(wnd.QueryControl(Flash::IID_IShockwaveFlash, (void**)&flash))) { MessageBox(wnd, TEXT("Failed to load Flash"), TEXT("Error"), MB_OK); ret = 1; goto end; } flash->Movie = L"file://c:/sample.swf"; flash->Menu = FALSE; MSG msg; while (GetMessage(&msg, NULL, 0, 0)){ TranslateMessage(&msg); DispatchMessage(&msg); } ret = msg.wParam; end: if (wnd) { wnd.DestroyWindow(); } _Module.Term(); return ret; }