Имя пользователя:
Пароль:
 

Показать сообщение отдельно

Пользователь


Сообщения: 76
Благодарности: 1

Профиль | Отправить PM | Цитировать


не работает он на 10-ке

Скрытый текст
Код: Выделить весь код
[Setup]
AppName=ICONKA
AppVerName=ICONKA
DefaultDirName=C:\ICONKA
OutputDir=userdocs:..\Desktop

[*Code]
function PinToTaskbar(const FileName: String; IsPin: Boolean): Boolean; var
    ShellApp: Variant;
    Verb: String;
  begin
    Result:=False;
      if not FileExists(FileName) then 
Exit; 
  try 
      if IsPin then
    Verb:='taskbarpin' 
  else
    Verb:='taskbarunpin';
    ShellApp:=CreateOleObject('Shell.Application');
    ShellApp.Windows.Item.Document.Application.NameSpace(ExtractFileDir(FileName)).ParseName(ExtractFileName(FileName)).InvokeVerb(Verb);
    Result:=True; 
  except 
    ShowExceptionMessage;
end
end;

procedure CurStepChanged(CurStep: TSetupStep);
  begin
      if CurStep=ssPostInstall then
  begin
    PinToTaskbar(ExpandConstant('{app}\ICONKA.exe'), True);
end
end;

[Files]
Source: "ICONKA.exe"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs


любой "ICONKA.exe" файл рядом положыте, на семерке без проблем а на десятке не робить
зато процедура "CurUninstallStepChanged" прекрасно работает даже на десятке

а это крепит ярлик в меню пуск и оно работает нормально
что на 7-ке что на 10-ке

Скрытый текст
Код: Выделить весь код
[Setup]
AppName=ICONKA
AppVerName=ICONKA
DefaultDirName=C:\ICONKA
OutputDir=userdocs:..\Desktop

[*Code]
function PinToStartMenu(const FileName: string; const IsPin: Boolean): Boolean; var
    ShellApp, FolderItem: Variant;
    Verb, LnkName: string;
  begin
    Result:=False;
      if not FileExists(FileName) then 
Exit;
  try
    ShellApp:=CreateOleObject('Shell.Application');
    FolderItem:=ShellApp.Windows.Item.Document.Application.NameSpace(ExtractFileDir(FileName)).ParseName(ExtractFileName(FileName));
      if GetWindowsVersion < $06020000 then
  begin
      if IsPin then
    Verb:='startpin' 
  else
    Verb:='startunpin';
    FolderItem.InvokeVerb(Verb);
    Result:=True;
end

  else begin
      if not FolderItem.IsLink then
  begin
    LnkName:=FolderItem.ExtendedProperty('FileDescription');
      if LnkName='' then
    LnkName:=ExtractFileName(FileName);
    LnkName:=ExpandConstant('{commonprograms}\') + ChangeFileExt(LnkName, '.lnk');
      if IsPin then
    Result:=not FileExists(LnkName) and
    FileExists(CreateShellLink(LnkName, '', FileName, '', '', '', 0, SW_SHOWNORMAL))
  else
    Result:=DeleteFile(LnkName);
end

  else begin
    LnkName:=ExpandConstant('{commonprograms}\') + ExtractFileName(FolderItem.Path);
      if IsPin then
    Result:=not FileExists(LnkName) and
    FileCopy(FolderItem.Path, LnkName, False)
  else
    Result:=DeleteFile(LnkName);
end
end;

  except
    ShowExceptionMessage;
end
end;

procedure CurStepChanged(CurStep: TSetupStep);
  begin
      if CurStep=ssPostInstall then
  begin
    PinToStartMenu(ExpandConstant('{app}\ICONKA.exe'), True);
end
end;

[Files]
Source: "ICONKA.exe"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

Последний раз редактировалось Beavimo, 09-02-2020 в 15:29.


Отправлено: 14:55, 09-02-2020 | #542