如何安装Windows媒体播放器9

 

;Code on installing the WMPlayer 9
;(can easily be adapted for other versions).
; Script generated June of 2003 by Rocinante Software S.L.
; Ed Eichman

[Setup]
AppName=WMPlayer9
AppVerName=WMPlayer9
DefaultDirName={sd}\WMPlayer9
DisableStartupPrompt=true
Uninstallable=false
DisableProgramGroupPage=true

;---- IMPORTANT!!!!---- IMPORTANT!!!!---- IMPORTANT!!!!---- IMPORTANT!!!!---- IMPORTANT!!!!---- IMPORTANT!!!!=
; According to the readme for MPSetup.exe, "You must be logged on as an administrator or a member of the=
;Administrators group to install Windows Media Player 9 Series on computers running Windows 2000, Windows XP=
;Home Edition, or Windows XP Professional. For more information about user accounts and groups, see Windows Help."=
PrivilegesRequired=admin
 
[Files]
;Obtain MPSetup.exe from http: //www.microsoft.com/windows/windowsmedia/download/
;You also need to get permission from MS for redistributing the file
Source: MPSetup.exe; DestDir: {tmp}; Flags: deleteafterinstall; Check: WMP9Needed

[Run]
;Run silently as shown in article "Redistributing Windows Media 9 Series Components":
;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwmt/html/RedisWMedC.asp:
;Note: This installer works with all WMPlayer9 system versions, including XP.:
;Although there is a separate installer for WMPlayer9XP, the installer for the other windows:
;version may be installed on XP. See
;http: //msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwmt/html/RedisWMedC.asp:
;where they say...
;The MPSetup.EXE package is supported on Windows 98 Second Edition, Windows Millennium Edition,:
;Windows 2000, and Windows XP. MPSetupXP.exe is optimized for and will run only on Windows XP.:
;There is no functional difference between installing MPSetup.exe and MPSetupXP on a computer:
;running Windows XP.
;NOTE: I tried this installer on XP, and it works fine.
Filename: {tmp}\MPSetup.exe; Parameters: """""""/q:A /c:""""""""setup_wm.exe /Q:A /R:N"" /P: ""#e""""""""""""; StatusMsg: """"Installing Windows Media Player 9...""""; Check:""WMP9Needed:"

[Code]
var
  bNeedsReboot: Boolean;

//------- --------- --------- --------- --------- --------- --------- --------- ---------
//Adapted from article "How to detect DirectX version " at
//http://www13.brinkster.com/vincenzog/isxart.asp?idart=7
procedure DecodeVersion( verstr: String; var verint: array of Integer );
var
  i,p: Integer; s: string;
  cSep: char;
begin
  //A little help for the Europeans
  cSep := '.';
  if (0 = pos ('.', verstr)) and (0 <> pos (',', verstr)) then begin
    cSep := ',';
  end;
  // initialize array
  verint := [0,0,0,0];
  i := 0;
  while ( (Length(verstr) > 0) and (i < 4) ) do
  begin
        p := pos(cSep, verstr);
        if p > 0 then
        begin
      if p = 1 then s:= '0' else s:= Copy( verstr, 1, p - 1 );
          verint[i] := StrToInt(s);
          i := i + 1;
          verstr := Copy( verstr, p+1, Length(verstr));
        end
        else
        begin
          verint[i] := StrToInt( verstr );
          verstr := '';
        end;
  end;

end;

//------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -------
//-----------------DETERMINING THE VERSION OF WMPlayer INSTALLED-----------------------------------------
//From "Redistributing Windows Media 9 Series Components" on MSDN
//http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwmt/html/RedisWMedC.asp
//In particular, the part where they say...
//Redistributing Windows Media Player 9 Series Software
//To include Windows Media Player in your application, you use the Window Media Player installation
//package, MPSetup.exe or MPSetupXP.exe. The MPSetup.EXE package is supported on Windows 98 Second
//Edition, Windows Millennium Edition, Windows 2000, and Windows XP. MPSetupXP.exe is optimized for
//and will run only on Windows XP. There is no functional difference between installing MPSetup.exe
//and MPSetupXP on a computer running Windows XP.
//Detecting Windows Media Player from an Application
//You can determine what version of Windows Media Player is installed by checking the following
//registry key:
//HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components
//For Windows Media Player 6.4, look at key {22d6f312-b0f6-11d0-94ab-0080c74c7e95}.
//For Windows Media Player 7, Windows Media Player for Windows XP, or Windows Media Player 9 Series;
//look at key {6BF52A52-394A-11d3-B153-00C04F79FAA6}.
//Under either of these keys, if the IsInstalled DWORD value is set to 0x1, you can safely use
//the "Version" string value as the version of Windows Media Player that is installed.
function WMP9Needed (): Boolean;
 var
   dwIsInstalled:  Cardinal;
   strVersion: String;
   lCurrInstalledVersion: Longint;
   verint: array of Integer;
begin
  Result := TRUE;
  RegQueryDWordValue(HKLM, 'Software\Microsoft\Active Setup\Installed Components\{6BF52A52-394A-11d3-B153-00C04F79FAA6}',
      'IsInstalled', dwIsInstalled);
   if 1 = dwIsInstalled then begin
    RegQueryStringValue(HKLM, 'Software\Microsoft\Active Setup\Installed Components\{6BF52A52-394A-11d3-B153-00C04F79FAA6}',
      'Version', strVersion);
    //MsgBox (strVersion, mbInformation, MB_OK);
    SetArrayLength (verint, 4);
    DecodeVersion (strVersion, verint);
    if verint[0] >= 9 then begin
      //MsgBox ('Its 9', mbInformation, MB_OK);
      Result := FALSE;
    end;
   end;
end;

//------- --------- --------- --------- --------- --------- --------- ------ --- ---------
function InitializeSetup(): Boolean;
begin
  //Make sure this gets checked AT THE BEGINNING.
  //Hmmm, my PASCAL skills are rusty - what is the best way to guarantee bNeedsReboot
  //is inited BEFORE any of the callbacks are called. Please let me know at
  //eeichman
  //--at--
  //rocinantesoftware.com
  bNeedsReboot := WMP9Needed;
  Result := TRUE;
end;

//------- --------- --------- --------- --------- --------- --------- --------- ---------
function NeedRestart(): Boolean;
begin
  //I'm not 100% sure that a reboot is needed if installing this, but what the hell.
  Result := bNeedsReboot or WMP9Needed;
end;

你可能感兴趣的:(职场,休闲)