Ветеран
Сообщения: 517
Благодарности: 314
|
Профиль
|
Отправить PM
| Цитировать
habib2302, я в своем скрипте сам разобратся не могу. Мой вопрос http://forum.oszone.net/post-2148420-416.html еще актуален))
Ну а по тому скрипту, вот:
читать дальше »
Код: 
[Tasks]
Name: quicklaunchiconforseven; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked; MinVersion: 0,6.1
[Code]
function LoadLibraryEx(lpFileName: String; hFile: THandle; dwFlags: DWORD): THandle; external 'LoadLibraryExW@kernel32.dll stdcall';
function LoadString(hInstance: THandle; uID: SmallInt; var lpBuffer: Char; nBufferMax: Integer): Integer; external 'LoadStringW@user32.dll stdcall';
// thank for code to "El Sanchez" from forum.oszone.net
procedure PinToTaskbar(Filename: String; IsPin: Boolean);
var
hInst: THandle;
buf: array [0..255] of char;
i, Res: Integer;
strVerb, sVBSFile: String;
objShell, colVerbs, oFile: Variant;
begin
if (GetWindowsVersion shr 24 < 6) or ((GetWindowsVersion shr 24 = 6) and ((GetWindowsVersion shr 16) and $FF < 1)) then Exit; // Windows 7 check
if not FileExists(Filename) then Exit;
if IsPin then Res := 5386 else Res := 5387;
begin
hInst := LoadLibraryEx(ExpandConstant('{sys}\shell32.dll'), 0, LOAD_LIBRARY_AS_DATAFILE);
if hInst <> 0 then
try
for i := 0 to LoadString(hInst, Res, buf[0], 255)-1 do strVerb := strVerb + Buf[i];
try
objShell := CreateOleObject('Shell.Application');
except
ShowExceptionMessage;
Exit;
end;
oFile := objShell.Namespace(ExtractFileDir(Filename)).ParseName(ExtractFileName(Filename));
colVerbs := oFile.Verbs;
if IsWin64 and (Pos (ExpandConstant ('{pf64}\'), Filename) = 1) then begin
sVBSFile := GenerateUniqueName (GetTempDir, 'mpc_be.vbs');
SaveStringToFile (sVBSFile, \
'Set oShell=CreateObject("Shell.Application")' + #13 + \
'Set oVerbs=oShell.NameSpace("' + ExtractFileDir (Filename) + '").ParseName("' + ExtractFileName (Filename) + '").Verbs' + #13 + \
'For Each oVerb In oVerbs' + #13 + \
' If (oVerb="' + strVerb + '") Then' + #13 + \
' oVerb.DoIt' + #13 + \
' Exit For' + #13 + \
' End If' + #13 + \
'Next' , False);
exec( ExpandConstant ('{win}\Sysnative\cscript.exe'), '"' + sVBSFile + '" /B', '', SW_HIDE, ewWaitUntilTerminated, i);
DeleteFile (sVBSFile);
end else begin
for i := colVerbs.Count downto 1 do if colVerbs.Item[i].Name = strVerb then begin
if (IsPin and oFile.IsLink) then
DeleteFile (ExpandConstant ('{userappdata}\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\') + ExtractFileName (Filename));
colVerbs.Item[i].DoIt;
Break;
end;
end;
finally
FreeDLL(hInst);
end;
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
case CurStep of
ssPostInstall: if IsTaskSelected('quicklaunchiconforseven') then PinToTaskbar(ExpandConstant('{app}\{#mpcbe_exe}'), True);
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
case CurUninstallStep of
usUninstall: PinToTaskbar(ExpandConstant('{app}\{#mpcbe_exe}'), False);
end;
end;
Хотя уважаемый Johny777 прав, в шапке есть.
|
Последний раз редактировалось saurn, 13-05-2013 в 14:52.
Отправлено: 14:35, 13-05-2013
| #430
|