请教!如何检测有没有安装Flash插件(80分)

  • 主题发起人 主题发起人 laohe
  • 开始时间 开始时间
L

laohe

Unregistered / Unconfirmed
GUEST, unregistred user!
请教!如何检测有没有安装Flash插件,如果没有就执行插件安装程序(如文件名:flash.exe);

谢谢大家的支持!急
 
參考一下如何檢測控制Word的示例吧,可能會有收獲的.
 
以前有看过一个例子,但现在一直找不到
 
用dreamweaver ,它的行为里自带了检测FLASH插件的代码

看看它生成的代码
 
看来是不行了,如果还没有人答,我只能关闭式发分
 
到注册表中去找啊!
它的CLSID是{D27CDB6E-AE6D-11cf-96B8-444553540000},如果注册了肯定会有
 
windbell提议好像不行呀!
 
是不行,还请高手再帮助
 
...determine if Macromedia Flash plugin is installed?

Autor: Frank
[Write new comment]
[ Print tip ]

Tip Rating (1):





program SeekFlash;

uses
Forms, Windows, INIFiles, SysUtils, Dialogs, ShellApi;

{$R *.RES}

type
TVersionInfo = record
dwSignature,
dwStrucVersion,
dwFileVersionMS,
dwFileVersionLS,
dwProductVersionMS,
dwProductVersionLS,
dwFileFlagsMask,
dwFileFlags,
dwFileOS,
dwFileType,
dwFileSubtype,
dwFileDateMS,
dwFileDateLS: DWORD;
end;


var
//Reg:TRegistry;
Ini: TIniFile;
Text: array[1..4] of string;

AppPath, IniFile, MySec: string;
SetupFile, RunFile, SetupClass: string;

VersionStr, BrowserStr: string;

{RegSubKey,} OpenBrowser, PlugInName, UseExt: string;
MainVersion: Word;
// FoundOne :Boolean;

PVer, DPchar, POpenBrowser: PChar;
MyPoint: Pointer;
PLen: Cardinal;
version: ^TVersionInfo;
DumD: DWORD;
LWord, HWord: Word;

CheckHandle: Hwnd;

//---------------------------
//Gets the Plugin (file-) Version
//---------------------------
procedure GetVersion(pluginName: string);
begin
DPChar := StrAlloc(255);
DPchar := PChar(PluginName);

PVer := StrAlloc(getFileVersionInfoSize(DPchar, Plen));
getFileVersionInfo(DPChar, 0, 255, PVer);
VerQueryValue(Pver, '/', MyPoint, Plen);

Version := myPoint;

dumD := Version.dwFileVersionMS;
hword := dumD shr 16;
lword := dumD and 255;

MainVersion := hword;
VersionStr := IntToStr(Hword) + '.' + IntToStr(LWord);

dumD := Version.dwFileVersionLs;
hword := dumD shr 16;
lword := dumD and 255;

versionStr := versionStr + '.' + IntToStr(Hword) + '.' + IntToStr(lWord);
end;

begin
appPath := extractFileDir(Application.exeName);


// runFile:= 'test.htm';
//runFile must be a html File to determin wich browser(NC or IE) is used
POpenBrowser := StrAlloc(255);
FindExecutable(PChar(extractFileName(runFile)),
PChar(extractFileDir(runFile)), POpenBrowser);
OpenBrowser := POpenBrowser;

if not Fileexists(openBrowser) then
begin
MessageDlg(Text[4], mtInformation, [mbOK], 0);
halt;
end;


//set the FileLocations for Netscape or IE
if Pos('NETSCAPE.EXE', uppercase(trim(OpenBrowser))) <> 0 then
begin //found Netscape
BrowserStr := 'Netscape Comunicator';
PlugInName := Copy(OpenBrowser, 1, Pos('NETSCAPE.EXE',
uppercase(trim(OpenBrowser))) - 1);
PluginName := PlugInName + 'Plugins/NPSWF32.dll';
end
else
//found IEExplorer
begin
BrowserStr := 'Internet Explorer';

DPChar := StrAlloc(255);
GetSystemDirectory(DPChar, 255);
PluginName := DPChar + '/Macromed/Flash/swflash.ocx';
DPChar := nil;
end;

GetVersion(pluginName);

//returned Version Number, may be checked
while mainVersion < 4 do
begin
if messagedlg(Text[2], mtInformation, [mbYes, mbNo], 0) = 6 then
begin
//installFlash;
end
// if message
else
halt;

getVersion(pluginName);
end; // while mainVer
end.
 
告诉你个最简单的方法:

var
flash : TShockWave(类的名字忘了,就当是这个)
begin
try
flash := TShockWave.create(nil);
except
showmessage('没有安装 flash');
winexec(flash差件安装);
exit;
end;
flash.free;
end;
end;
 
另外建议你flash的组件最好动态生成
否则在切换影片时,背景色会出现错误
 
还可以通过C:/%windir%/system32/Macromed/Flash/flash.ocx或swflash.ocx文件是否存在
在9x下是在c:/%windir%/system/macromed/flash/flash.ocx或swflash.ocx
 
后退
顶部