"草原骏马"说的没错创建资源文件:从记事本中新建一个文本文件。在文件中写入以下内容:Flash RCDATA "SWFLASH.OCX"将文件存为Filename.rc,如FlashOCX.rc。将此文件与“SWFLASH.OCX”放入同一个目录中。然后在MS-DOS命令行下,在你的Delphi bin子目录中找到brcc.exe文件。执行以下命令:Brcc32 [路径]/FlashOCX.rc例如:Brcc32 c:/windows/system/flashocx.rc现在“FLASHOCX.RES”文件就创建完毕了。你可以将这个文件包含到你的应用程序中:{$R.RES}{$R FLASHOCX.RES}“R”表示将资源文件包含到程序中。展开及注册:首先我们要检查一下Flash文件是否能正常播放。点击Project --> View Source(在Delphi5中),选择工程代码。我们需要做的是检测在创建第一个窗体时的“EOleSysError”消息。如果错误产生,就说明OCX控件在系统中还未注册:uses comobjbeginApplication.Initialize;tryApplication.CreateForm(TForm1, Form1);exceptOn EOleSysError Dobegin//Register OCX File because not found.end;end;Application.Run;end.下一段代码显示了如何展开资源文件,并放入Windows系统目录中:useswindows, classes, sysutilsvaraSystemDirZ : array[0..2047] of Char;fSystemDir : String;...GetSystemDirectory ( aSystemDirZ, 2047 );fSystemDir := aSystemDirZ;ResStream := TResourceStream.Create(0, 'Flash', RT_RCDATA);tryFileStream := TFileStream.Create(fSystemDir+'SWFLASH.OCX', fmCreate);tryFileStream.CopyFrom(ResStream, 0);finallyFileStream.Free;end;finallyResStream.Free;end;完整代码:program FlashPlayer;usesForms, Dialogs, comobj, windows, classes, sysutils,uMain in 'uMain.pas' {Form1};{$R *.RES}{$R FLASHOCX.RES}typeTRegFunc = function : HResult; stdcall;function WinExecAndWait32( FileName: String; Visibility : Integer ) : Cardinal;varzAppName : array[0..512] of char;zCurDir : array[0..255] of char;WorkDir : String;StartupInfo : TStartupInfo;ProcessInfo : TProcessInformation;beginStrPCopy( zAppName, FileName );GetDir ( 0, WorkDir );StrPCopy( zCurDir, WorkDir );FillChar( StartupInfo, Sizeof( StartupInfo ), #0 );StartupInfo.cb := Sizeof( StartupInfo );StartupInfo.dwFlags := STARTF_USESHOWWINDOW;StartupInfo.wShowWindow := Visibility;if ( not CreateProcess( nil,zAppName, { pointer to command line string }nil, { pointer to process security attributes }nil, { pointer to thread security attributes }false, { handle inheritance flag }CREATE_NEW_CONSOLE or { creation flags }NORMAL_PRIORITY_CLASS,nil, { pointer to new environment block }zCurDir, { pointer to current directory name }StartupInfo, { pointer to STARTUPINFO }ProcessInfo ) ) thenbeginResult := $FFFFFFFF; { pointer to PROCESS_INF }MessageBox( Application.Handle, PChar( SysErrorMessage( GetLastError ) ), 'Yipes!', 0 );endelsebeginWaitforSingleObject( ProcessInfo.hProcess, INFINITE );GetExitCodeProcess ( ProcessInfo.hProcess, Result );CloseHandle ( ProcessInfo.hProcess );CloseHandle ( ProcessInfo.hThread );end;end;varaSystemDirZ : array[0..2047] of Char;aShortPath : array[0..2047] of Char;fSystemDir : String;aCommand : String;aHandle : Cardinal;aFunc : TRegFunc;ResStream : TResourceStream;FileStream : TFileStream;beginGetSystemDirectory ( aSystemDirZ, 2047 );fSystemDir := aSystemDirZ;Application.Initialize;tryApplication.CreateForm(TForm1, Form1);exceptOn EOleSysError DobeginResStream := TResourceStream.Create(0, 'Flash', RT_RCDATA);tryFileStream := TFileStream.Create(fSystemDir+'SWFLASH.OCX', fmCreate);tryFileStream.CopyFrom(ResStream, 0);finallyFileStream.Free;end;finallyResStream.Free;end;try{Register the OCX File}aHandle := LoadLibrary( PChar( fSystemDir+'SWFLASH.OCX' ) );if ( aHandle >= 32 ) thenbeginaFunc := GetProcAddress( aHandle, 'DllRegisterServer' );if ( Assigned( aFunc ) = TRUE ) thenbeginGetShortPathName( PChar( fSystemDir+'SWFLASH.OCX' ), aShortPath, 2047 );aCommand := Format( '%segsvr32.exe /s %s', [fSystemDir, aShortPath] );WinExecAndWait32( aCommand, SW_HIDE );end;FreeLibrary( aHandle );end;//Try Creating the Form AgaintryApplication.CreateForm(TForm1, Form1);exceptShowMessage('Unable to find Macromedia Shockwave Flash.');end;exceptShowMessage('Unable to register Macromedia Shockwave Flash.');end;{End of Registering the OCX File}end;end;Application.Run;end.代码结束。如何使用ActiveX控制:属性ReadyState(只读)——0=loading,1=Uninitialized,2=Loaded,3=Interactive,4=Complete。TotalFrames(只读)——返回movie中的总帧数。只在movie Loaded状态下可用(ReadyState=2)。FrameNum——movie的当前帧。设置FrameNum的值会导致movie的前进或后退。Playing——播放时为True,暂停时为False。Quality——当前渲染质量,0=Low,1=High,2=AutoLow,3=AutoHigh。ScaleMode——显示模式,0=ShowAll,1=NoBorder,2=ExactFit。AlignMode——对齐模式,Left=+1,Right=+2,Top=+4,Bottom=+8。BackgroundColor——覆盖movie的背景颜色。形式为“红*65536+绿*256+兰”的整数。-1为默认值。Loop——循环播放时为True,播放一次为False。Movie——Flash Movie文件的URL地址。设置Movie属性会导致重新读取一个新的movie。方法Play——开始播放动画。Stop——停止播放动画。Back——返回上一帧。Forward——到下一帧。Rewind——到第一帧。SetZoomRect(int left,int top,int right,int,bottom)——将movie缩放到一个矩形区域。注意:单位是twip(1/1440英寸)。Zoom(int percent)——缩放视区的大小。Zoom(50)将movie放大两倍,Zoom(200)将movie缩小到1/2。Pan(int x,int y,int mode)——拖动一个缩放的movie。mode参数为:0=pixels,1=%。事件OnProgress(int percent)——当Flash Movie下载时触发。OnReadyStateChange(int state)——当控件的ReadyState改变时触发。FSCommand(string command,string args)——当以“FSCommand:”开头的URL被用于GetURL动作时触发。此事件可以用来相应Flash Movie中的按钮事件。