#pragma comment(lib, "comsuppw.lib") //加这个库有什么用//////////////////////////////////////////////////////////////////////////
// Interfaces imported from flash.ocx#include <comdef.h> //COM 组件头文件#pragma pack(push, 8) //这个不知道是什么意思namespace ShockwaveFlashObjects //命名空间
{//
// Forward references and typedefs
//
struct __declspec(uuid("d27cdb6b-ae6d-11cf-96b8-444553540000"))
/* LIBID */ __ShockwaveFlashObjects;
struct __declspec(uuid("d27cdb6c-ae6d-11cf-96b8-444553540000"))
/* dual interface */ IShockwaveFlash;
struct __declspec(uuid("d27cdb6d-ae6d-11cf-96b8-444553540000"))
/* dispinterface */ _IShockwaveFlashEvents;
struct /* coclass */ ShockwaveFlash;
struct /* coclass */ FlashProp;
struct __declspec(uuid("d27cdb70-ae6d-11cf-96b8-444553540000"))
/* interface */ IFlashFactory;
struct __declspec(uuid("d27cdb72-ae6d-11cf-96b8-444553540000"))
/* interface */ IFlashObjectInterface;
struct __declspec(uuid("a6ef9860-c720-11d0-9337-00a0c90dcaa9"))
/* interface */ IDispatchEx;
struct /* coclass */ FlashObjectInterface;//
// Smart pointer typedef declarations
//
//以上东西不知道有什么用
_COM_SMARTPTR_TYPEDEF(IShockwaveFlash, __uuidof(IShockwaveFlash));
_COM_SMARTPTR_TYPEDEF(_IShockwaveFlashEvents, __uuidof(_IShockwaveFlashEvents));
_COM_SMARTPTR_TYPEDEF(IFlashFactory, __uuidof(IFlashFactory));
_COM_SMARTPTR_TYPEDEF(IDispatchEx, __uuidof(IDispatchEx));
_COM_SMARTPTR_TYPEDEF(IFlashObjectInterface, __uuidof(IFlashObjectInterface));//以上不知道是什么东西
//
// Type library items
//struct __declspec(uuid("d27cdb6c-ae6d-11cf-96b8-444553540000"))
IShockwaveFlash : IDispatch
{
//
// Property data
//
// virtual HRESULT __stdcall get_ReadyState ( //
/*[out,retval]*/ long * thestate ) = 0;
virtual HRESULT __stdcall get_TotalFrames ( // 获取动画总帧数
/*[out,retval]*/ long * numframes ) = 0;
virtual HRESULT __stdcall get_Playing ( // 获取是否播放中
/*[out,retval]*/ VARIANT_BOOL * Playing ) = 0;
virtual HRESULT __stdcall put_Playing ( //
/*[in]*/ VARIANT_BOOL Playing ) = 0;
virtual HRESULT __stdcall get_Quality (
/*[out,retval]*/ int * Quality ) = 0;
virtual HRESULT __stdcall put_Quality (
/*[in]*/ int Quality ) = 0;
virtual HRESULT __stdcall get_ScaleMode (
/*[out,retval]*/ int * scale ) = 0;
virtual HRESULT __stdcall put_ScaleMode (
/*[in]*/ int scale ) = 0;
virtual HRESULT __stdcall get_AlignMode (
/*[out,retval]*/ int * align ) = 0;
virtual HRESULT __stdcall put_AlignMode (
/*[in]*/ int align ) = 0;
virtual HRESULT __stdcall get_BackgroundColor (
/*[out,retval]*/ long * color ) = 0;
virtual HRESULT __stdcall put_BackgroundColor (
/*[in]*/ long color ) = 0;
virtual HRESULT __stdcall get_Loop (
/*[out,retval]*/ VARIANT_BOOL * Loop ) = 0;
virtual HRESULT __stdcall put_Loop (
/*[in]*/ VARIANT_BOOL Loop ) = 0;
virtual HRESULT __stdcall get_Movie (
/*[out,retval]*/ BSTR * path ) = 0;
virtual HRESULT __stdcall put_Movie (
/*[in]*/ BSTR path ) = 0;
virtual HRESULT __stdcall get_FrameNum (
/*[out,retval]*/ long * FrameNum ) = 0;
virtual HRESULT __stdcall put_FrameNum (
/*[in]*/ long FrameNum ) = 0;
virtual HRESULT __stdcall SetZoomRect (
/*[in]*/ long left,
/*[in]*/ long top,
/*[in]*/ long right,
/*[in]*/ long bottom ) = 0;
virtual HRESULT __stdcall Zoom (
/*[in]*/ int factor ) = 0;
virtual HRESULT __stdcall Pan (
/*[in]*/ long x,
/*[in]*/ long y,
/*[in]*/ int mode ) = 0;
virtual HRESULT __stdcall Play ( ) = 0; // 播放
virtual HRESULT __stdcall Stop ( ) = 0; // 停止
virtual HRESULT __stdcall Back ( ) = 0; // 上一帧
virtual HRESULT __stdcall Forward ( ) = 0; //
virtual HRESULT __stdcall Rewind ( ) = 0; // 返回动画第一帧
virtual HRESULT __stdcall StopPlay ( ) = 0; // 停止播放
virtual HRESULT __stdcall GotoFrame ( // 跳转到指定帧
/*[in]*/ long FrameNum ) = 0;
virtual HRESULT __stdcall CurrentFrame ( // 返回当前帧
/*[out,retval]*/ long * FrameNum ) = 0;
virtual HRESULT __stdcall IsPlaying ( // 动画是否正在播放
/*[out,retval]*/ VARIANT_BOOL * Playing ) = 0;
virtual HRESULT __stdcall PercentLoaded ( // 动画加载的进度百分比
/*[out,retval]*/ long * __MIDL_0011 ) = 0;
virtual HRESULT __stdcall FrameLoaded ( // 帧
/*[in]*/ long FrameNum,
/*[out,retval]*/ VARIANT_BOOL * loaded ) = 0;
virtual HRESULT __stdcall FlashVersion ( // Flash版本 /*[in]*/ VARIANT_BOOL pVal ) = 0;
virtual HRESULT __stdcall get_BGColor (
/*[out,retval]*/ BSTR * pVal ) = 0;
virtual HRESULT __stdcall put_BGColor (
/*[in]*/ BSTR pVal ) = 0;
};struct __declspec(uuid("d27cdb6d-ae6d-11cf-96b8-444553540000"))
_IShockwaveFlashEvents : IDispatch
{
//
// Wrapper methods for error-handling
// // Methods:
HRESULT OnReadyStateChange (
long newState );
HRESULT OnProgress (
long percentDone );
HRESULT FSCommand (
_bstr_t command,
_bstr_t args );
};struct __declspec(uuid("d27cdb6e-ae6d-11cf-96b8-444553540000"))
ShockwaveFlash;
// [ default ] interface IShockwaveFlash
// [ default, source ] dispinterface _IShockwaveFlashEventsstruct __declspec(uuid("1171a62f-05d2-11d1-83fc-00a0c9089c5a"))
FlashProp;
// [ default ] interface IUnknownstruct __declspec(uuid("d27cdb70-ae6d-11cf-96b8-444553540000"))
IFlashFactory : IUnknown
{};struct __declspec(uuid("a6ef9860-c720-11d0-9337-00a0c90dcaa9"))
IDispatchEx : IDispatch
{
//
// Wrapper methods for error-handling
// HRESULT GetDispID (
_bstr_t bstrName,
unsigned long grfdex,
long * pid );
HRESULT RemoteInvokeEx (
long id,
unsigned long lcid,
unsigned long dwFlags,
struct DISPPARAMS * pdp,
VARIANT * pvarRes,
struct EXCEPINFO * pei,
struct IServiceProvider * pspCaller,
unsigned int cvarRefArg,
unsigned int * rgiRefArg,
VARIANT * rgvarRefArg );
HRESULT DeleteMemberByName (
_bstr_t bstrName,
unsigned long grfdex );
HRESULT DeleteMemberByDispID (
long id );
HRESULT GetMemberProperties (
long id,
unsigned long grfdexFetch,
unsigned long * pgrfdex );
HRESULT GetMemberName (
long id,
BSTR * pbstrName );
HRESULT GetNextDispID (
unsigned long grfdex,
long id,
long * pid );
HRESULT GetNameSpaceParent (
IUnknown * * ppunk ); //
// Raw methods provided by interface
// virtual HRESULT __stdcall raw_GetDispID (
/*[in]*/ BSTR bstrName,
/*[in]*/ unsigned long grfdex,
/*[out]*/ long * pid ) = 0;
};struct __declspec(uuid("d27cdb72-ae6d-11cf-96b8-444553540000"))
IFlashObjectInterface : IDispatchEx
{};struct __declspec(uuid("d27cdb71-ae6d-11cf-96b8-444553540000"))
FlashObjectInterface;
// [ default ] interface IFlashObjectInterface} // namespace ShockwaveFlashObjects#pragma pack(pop)using namespace ShockwaveFlashObjects;const CLSID CLSID_ShockwaveFlash =
{ 0xD27CDB6E, 0xAE6D, 0x11cf, {0x96, 0xB8, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} };typedef HRESULT (__stdcall *DllGetClassObjectFunc)(REFCLSID rclsid, REFIID riid, LPVOID
问题1:
上面的程序是 flash 自己的
还是 windows 播放 flash 的 Activex ?2:
#pragma pack(push, 8)
//加一些程序语句
#pragma pack(pop)这是什么语法?
有什么用? 谢谢!
// Interfaces imported from flash.ocx#include <comdef.h> //COM 组件头文件#pragma pack(push, 8) //这个不知道是什么意思namespace ShockwaveFlashObjects //命名空间
{//
// Forward references and typedefs
//
struct __declspec(uuid("d27cdb6b-ae6d-11cf-96b8-444553540000"))
/* LIBID */ __ShockwaveFlashObjects;
struct __declspec(uuid("d27cdb6c-ae6d-11cf-96b8-444553540000"))
/* dual interface */ IShockwaveFlash;
struct __declspec(uuid("d27cdb6d-ae6d-11cf-96b8-444553540000"))
/* dispinterface */ _IShockwaveFlashEvents;
struct /* coclass */ ShockwaveFlash;
struct /* coclass */ FlashProp;
struct __declspec(uuid("d27cdb70-ae6d-11cf-96b8-444553540000"))
/* interface */ IFlashFactory;
struct __declspec(uuid("d27cdb72-ae6d-11cf-96b8-444553540000"))
/* interface */ IFlashObjectInterface;
struct __declspec(uuid("a6ef9860-c720-11d0-9337-00a0c90dcaa9"))
/* interface */ IDispatchEx;
struct /* coclass */ FlashObjectInterface;//
// Smart pointer typedef declarations
//
//以上东西不知道有什么用
_COM_SMARTPTR_TYPEDEF(IShockwaveFlash, __uuidof(IShockwaveFlash));
_COM_SMARTPTR_TYPEDEF(_IShockwaveFlashEvents, __uuidof(_IShockwaveFlashEvents));
_COM_SMARTPTR_TYPEDEF(IFlashFactory, __uuidof(IFlashFactory));
_COM_SMARTPTR_TYPEDEF(IDispatchEx, __uuidof(IDispatchEx));
_COM_SMARTPTR_TYPEDEF(IFlashObjectInterface, __uuidof(IFlashObjectInterface));//以上不知道是什么东西
//
// Type library items
//struct __declspec(uuid("d27cdb6c-ae6d-11cf-96b8-444553540000"))
IShockwaveFlash : IDispatch
{
//
// Property data
//
// virtual HRESULT __stdcall get_ReadyState ( //
/*[out,retval]*/ long * thestate ) = 0;
virtual HRESULT __stdcall get_TotalFrames ( // 获取动画总帧数
/*[out,retval]*/ long * numframes ) = 0;
virtual HRESULT __stdcall get_Playing ( // 获取是否播放中
/*[out,retval]*/ VARIANT_BOOL * Playing ) = 0;
virtual HRESULT __stdcall put_Playing ( //
/*[in]*/ VARIANT_BOOL Playing ) = 0;
virtual HRESULT __stdcall get_Quality (
/*[out,retval]*/ int * Quality ) = 0;
virtual HRESULT __stdcall put_Quality (
/*[in]*/ int Quality ) = 0;
virtual HRESULT __stdcall get_ScaleMode (
/*[out,retval]*/ int * scale ) = 0;
virtual HRESULT __stdcall put_ScaleMode (
/*[in]*/ int scale ) = 0;
virtual HRESULT __stdcall get_AlignMode (
/*[out,retval]*/ int * align ) = 0;
virtual HRESULT __stdcall put_AlignMode (
/*[in]*/ int align ) = 0;
virtual HRESULT __stdcall get_BackgroundColor (
/*[out,retval]*/ long * color ) = 0;
virtual HRESULT __stdcall put_BackgroundColor (
/*[in]*/ long color ) = 0;
virtual HRESULT __stdcall get_Loop (
/*[out,retval]*/ VARIANT_BOOL * Loop ) = 0;
virtual HRESULT __stdcall put_Loop (
/*[in]*/ VARIANT_BOOL Loop ) = 0;
virtual HRESULT __stdcall get_Movie (
/*[out,retval]*/ BSTR * path ) = 0;
virtual HRESULT __stdcall put_Movie (
/*[in]*/ BSTR path ) = 0;
virtual HRESULT __stdcall get_FrameNum (
/*[out,retval]*/ long * FrameNum ) = 0;
virtual HRESULT __stdcall put_FrameNum (
/*[in]*/ long FrameNum ) = 0;
virtual HRESULT __stdcall SetZoomRect (
/*[in]*/ long left,
/*[in]*/ long top,
/*[in]*/ long right,
/*[in]*/ long bottom ) = 0;
virtual HRESULT __stdcall Zoom (
/*[in]*/ int factor ) = 0;
virtual HRESULT __stdcall Pan (
/*[in]*/ long x,
/*[in]*/ long y,
/*[in]*/ int mode ) = 0;
virtual HRESULT __stdcall Play ( ) = 0; // 播放
virtual HRESULT __stdcall Stop ( ) = 0; // 停止
virtual HRESULT __stdcall Back ( ) = 0; // 上一帧
virtual HRESULT __stdcall Forward ( ) = 0; //
virtual HRESULT __stdcall Rewind ( ) = 0; // 返回动画第一帧
virtual HRESULT __stdcall StopPlay ( ) = 0; // 停止播放
virtual HRESULT __stdcall GotoFrame ( // 跳转到指定帧
/*[in]*/ long FrameNum ) = 0;
virtual HRESULT __stdcall CurrentFrame ( // 返回当前帧
/*[out,retval]*/ long * FrameNum ) = 0;
virtual HRESULT __stdcall IsPlaying ( // 动画是否正在播放
/*[out,retval]*/ VARIANT_BOOL * Playing ) = 0;
virtual HRESULT __stdcall PercentLoaded ( // 动画加载的进度百分比
/*[out,retval]*/ long * __MIDL_0011 ) = 0;
virtual HRESULT __stdcall FrameLoaded ( // 帧
/*[in]*/ long FrameNum,
/*[out,retval]*/ VARIANT_BOOL * loaded ) = 0;
virtual HRESULT __stdcall FlashVersion ( // Flash版本 /*[in]*/ VARIANT_BOOL pVal ) = 0;
virtual HRESULT __stdcall get_BGColor (
/*[out,retval]*/ BSTR * pVal ) = 0;
virtual HRESULT __stdcall put_BGColor (
/*[in]*/ BSTR pVal ) = 0;
};struct __declspec(uuid("d27cdb6d-ae6d-11cf-96b8-444553540000"))
_IShockwaveFlashEvents : IDispatch
{
//
// Wrapper methods for error-handling
// // Methods:
HRESULT OnReadyStateChange (
long newState );
HRESULT OnProgress (
long percentDone );
HRESULT FSCommand (
_bstr_t command,
_bstr_t args );
};struct __declspec(uuid("d27cdb6e-ae6d-11cf-96b8-444553540000"))
ShockwaveFlash;
// [ default ] interface IShockwaveFlash
// [ default, source ] dispinterface _IShockwaveFlashEventsstruct __declspec(uuid("1171a62f-05d2-11d1-83fc-00a0c9089c5a"))
FlashProp;
// [ default ] interface IUnknownstruct __declspec(uuid("d27cdb70-ae6d-11cf-96b8-444553540000"))
IFlashFactory : IUnknown
{};struct __declspec(uuid("a6ef9860-c720-11d0-9337-00a0c90dcaa9"))
IDispatchEx : IDispatch
{
//
// Wrapper methods for error-handling
// HRESULT GetDispID (
_bstr_t bstrName,
unsigned long grfdex,
long * pid );
HRESULT RemoteInvokeEx (
long id,
unsigned long lcid,
unsigned long dwFlags,
struct DISPPARAMS * pdp,
VARIANT * pvarRes,
struct EXCEPINFO * pei,
struct IServiceProvider * pspCaller,
unsigned int cvarRefArg,
unsigned int * rgiRefArg,
VARIANT * rgvarRefArg );
HRESULT DeleteMemberByName (
_bstr_t bstrName,
unsigned long grfdex );
HRESULT DeleteMemberByDispID (
long id );
HRESULT GetMemberProperties (
long id,
unsigned long grfdexFetch,
unsigned long * pgrfdex );
HRESULT GetMemberName (
long id,
BSTR * pbstrName );
HRESULT GetNextDispID (
unsigned long grfdex,
long id,
long * pid );
HRESULT GetNameSpaceParent (
IUnknown * * ppunk ); //
// Raw methods provided by interface
// virtual HRESULT __stdcall raw_GetDispID (
/*[in]*/ BSTR bstrName,
/*[in]*/ unsigned long grfdex,
/*[out]*/ long * pid ) = 0;
};struct __declspec(uuid("d27cdb72-ae6d-11cf-96b8-444553540000"))
IFlashObjectInterface : IDispatchEx
{};struct __declspec(uuid("d27cdb71-ae6d-11cf-96b8-444553540000"))
FlashObjectInterface;
// [ default ] interface IFlashObjectInterface} // namespace ShockwaveFlashObjects#pragma pack(pop)using namespace ShockwaveFlashObjects;const CLSID CLSID_ShockwaveFlash =
{ 0xD27CDB6E, 0xAE6D, 0x11cf, {0x96, 0xB8, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} };typedef HRESULT (__stdcall *DllGetClassObjectFunc)(REFCLSID rclsid, REFIID riid, LPVOID
问题1:
上面的程序是 flash 自己的
还是 windows 播放 flash 的 Activex ?2:
#pragma pack(push, 8)
//加一些程序语句
#pragma pack(pop)这是什么语法?
有什么用? 谢谢!
2.http://www.shineblog.com/user3/romanticode/archives/2007/772158.shtml
作用是在程序中加载flash文件并控制其播放,处理flash返回的消息。
HRESULT FSCommand 这个函数是程序和程序内部加载flash之间通讯的时候用的,我用过。
我把导入语句 #import "c:\\windows\\system32\\macromed\\flash\\Flash.ocx" named_guids 改为
#import "c:\\windows\\system32\\macromed\\flash\\Flash10b.ocx" named_guids, 因为我电脑 flash 目录下就是flash10b.ocx文件, 然后编译,但是却出现下面的编译错误,请指教!谢谢1>正在编译...
1>flash.cpp
1>e:\codesource\flash\flashwnd.h(972) : error C2039: “IServiceProvider”: 不是“ShockwaveFlashObjects”的成员
1>e:\codesource\flash\flash.cpp(63) : error C2259: “CFlashWnd”: 不能实例化抽象类
1> 由于下列成员:
1> “HRESULT IServiceProvider::QueryService(const GUID &,const IID &,void **)”: 是抽象的
1> c:\program files\microsoft sdks\windows\v6.0a\include\servprov.h(106) : 参见“IServiceProvider::QueryService”的声明
1>FlashWnd.cpp
1>e:\codesource\flash\flashwnd.h(972) : error C2039: “IServiceProvider”: 不是“ShockwaveFlashObjects”的成员
1>e:\codesource\flash\flashwnd.cpp(107) : error C2039: “IID_IServiceProvider”: 不是“ShockwaveFlashObjects”的成员
1>e:\codesource\flash\flashwnd.cpp(108) : error C2039: “IServiceProvider”: 不是“ShockwaveFlashObjects”的成员
1>e:\codesource\flash\flashwnd.cpp(193) : error C2248: “_com_ptr_t<_IIID>::_AddRef”: 无法访问 private 成员(在“_com_ptr_t<_IIID>”类中声明)
1> with
1> [
1> _IIID=_com_IIID<IDirectDraw4,& IID_IDirectDraw4>
1> ]
1> c:\program files\microsoft visual studio 9.0\vc\include\comip.h(830) : 参见“_com_ptr_t<_IIID>::_AddRef”的声明
1> with
1> [
1> _IIID=_com_IIID<IDirectDraw4,& IID_IDirectDraw4>
1> ]
1>正在生成代码...
1>生成日志保存在“file://E:\CodeSource\flash\Debug\BuildLog.htm”
1>flash - 6 个错误,0 个警告