荆门热水器师傅维修:怎样不使用mfc和atl播放flash?

来源:百度文库 编辑:高考问答 时间:2024/04/27 12:48:00
我想不用mfc和atl播放flash,我的代码如下,为什么放不了啊,请高手耐心指正
#include <windows.h>
#import "flash.ocx"
using namespace ShockwaveFlashObjects;
HINSTANCE app;
HWND win;
IUnknown *un;
IShockwaveFlash* flash;
const IID id={0xd27cdb6e,0xae6d,0x11cf,
{0x96,0xb8,0x44,0x45,0x53,0x54,0x0,0x0} };

LRESULT CALLBACK zhu(HWND, UINT, WPARAM, LPARAM);
int APIENTRY WinMain(HINSTANCE a,HINSTANCE b,LPSTR c,int d)
{

app=a;
MSG msg;
WNDCLASS winclass;
HWND winjubin;
winclass.cbClsExtra=0;
winclass.cbWndExtra=0;
winclass.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);
winclass.hCursor=LoadCursor(a,"shu");
winclass.hIcon=NULL;
winclass.hInstance=0;
winclass.lpfnWndProc=(WNDPROC)zhu;
winclass.lpszClassName="windows程序";
winclass.lpszMenuName="windows程序";
winclass.style=CS_HREDRAW|CS_VREDRAW;
RegisterClass(&winclass);
winjubin=CreateWindow("windows程序","windows程序",WS_OVERLAPPEDWINDOW,
50,50,640,480,NULL,NULL,a,NULL);
win=winjubin;

CoInitialize(NULL);
CoCreateInstance(id,NULL,CLSCTX_INPROC_SERVER,IID_IUnknown,(void**)&un);
un->QueryInterface(__uuidof(IShockwaveFlash), (void**)&flash);
ShowWindow(winjubin,d);
UpdateWindow(winjubin);
while(GetMessage(&msg,NULL,0,0))
{TranslateMessage(&msg);
DispatchMessage(&msg);
}
return(msg.wParam);
}
LRESULT CALLBACK zhu(HWND a, UINT b, WPARAM c, LPARAM d)
{switch(b)
{ case WM_CREATE:
break;

case WM_DESTROY:
if(flash){flash->Release();}
CoUninitialize();
PostQuitMessage(0);
break;
case WM_LBUTTONDOWN:
bstr=_bstr_t("C:\\jm.swf");
flash->put_Movie(bstr);
flash->Play();
break;

default:
return(DefWindowProc(a,b,c,d));
}
return(0L);
}
我想可能是没有创建放flash的控件,可怎么创建?用CreateWindow吗?窗口类参数改填什么?

可以通过注册了的 FlashPlayer Shockwave ActiveX 控件来播放。