Infos eine Verknüpfung

Hier kann alles mögliche diskutiert werden. Themen zu Purebasic sind hier erwünscht.
Flames und Spam kommen ungefragt in den Mülleimer.
Benutzeravatar
STARGÅTE
Kommando SG1
Beiträge: 7031
Registriert: 01.11.2005 13:34
Wohnort: Glienicke
Kontaktdaten:

Infos eine Verknüpfung

Beitrag von STARGÅTE »

Wie komme ich an die Zieldaten einer Verknüpfung ohne dieses Eingenschaften-Fenster aufzurufen ?

Alle Textbearbeitungsprogramme leiten mich immer zu der echten Datei, ich will aber die Verknüpfung ändern.

Hat jemand ne Idee ?
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Aktuelles Projekt: Lizard - Skriptsprache für symbolische Berechnungen und mehr
Benutzeravatar
vonTurnundTaxis
Beiträge: 2130
Registriert: 06.10.2004 20:38
Wohnort: Bayreuth
Kontaktdaten:

Beitrag von vonTurnundTaxis »

Falls es sich in deinem Fall um echte Links handelt, sind diese keine eigenen Dateien, sondern zusätzliche Einträge im Dateisystem.
Falls es sich in deinem Fall um Windows-Verknüpfungen handelt, sollte dieses Thema helfen.
Falls es sich in deinem Fall um KDE-Verknüpfungen handelt, hast du das Problem nicht ;)
Nicht durch Zorn, sondern durch Lachen tötet man
ClipGrab | Pastor - jetzt mit kurzen URLs!
Benutzeravatar
STARGÅTE
Kommando SG1
Beiträge: 7031
Registriert: 01.11.2005 13:34
Wohnort: Glienicke
Kontaktdaten:

Beitrag von STARGÅTE »

ich ahe es jetzt selber auch geschafft <)

Ich habe die "Datei.lnk" einfach mit ReadFile() öffnen lassen und habe eine neue "Datei.txt" geschrieben.

EDIT :

mist geht doch nicht :cry: war nur bei manchen zufall :cry: , naja ich guck mir mal den Link an, danke
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Aktuelles Projekt: Lizard - Skriptsprache für symbolische Berechnungen und mehr
Benutzeravatar
ts-soft
Beiträge: 22292
Registriert: 08.09.2004 00:57
Computerausstattung: Mainboard: MSI 970A-G43
CPU: AMD FX-6300 Six-Core Processor
GraKa: GeForce GTX 750 Ti, 2 GB
Memory: 16 GB DDR3-1600 - Dual Channel
Wohnort: Berlin

Beitrag von ts-soft »

Bei den lnk Dateien ~2000 bytes mußte vorsichtig sein, die werden Teilweise
vom Installer überwacht. Verschieben kann man die nicht, und ändern evtl.
auch nicht. Normalle lnk Dateien, also die wesentlich kleineren, die kannste
Manipulieren ohne Probleme.
PureBasic 5.73 LTS | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Nutella hat nur sehr wenig Vitamine. Deswegen muss man davon relativ viel essen.
Bild
Benutzeravatar
STARGÅTE
Kommando SG1
Beiträge: 7031
Registriert: 01.11.2005 13:34
Wohnort: Glienicke
Kontaktdaten:

Beitrag von STARGÅTE »

ts-soft hat geschrieben:Bei den lnk Dateien ~2000 bytes mußte vorsichtig sein, die werden Teilweise
vom Installer überwacht. Verschieben kann man die nicht, und ändern evtl.
auch nicht. Normalle lnk Dateien, also die wesentlich kleineren, die kannste
Manipulieren ohne Probleme.
Mein ziel ist es eine *.lnk zu schreiben die dann nciht als Fehler anzeigt : "Datei konnte nicht gefunden werden" weil ich sie einfach nur kopiert habe.
Genau diese lnk Dateien ~2000 bytes will ich ändern, ich kann da auch sachen rauslesen aber ich weiß nicht was was sein soll :oops:
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Aktuelles Projekt: Lizard - Skriptsprache für symbolische Berechnungen und mehr
Benutzeravatar
ts-soft
Beiträge: 22292
Registriert: 08.09.2004 00:57
Computerausstattung: Mainboard: MSI 970A-G43
CPU: AMD FX-6300 Six-Core Processor
GraKa: GeForce GTX 750 Ti, 2 GB
Memory: 16 GB DDR3-1600 - Dual Channel
Wohnort: Berlin

Beitrag von ts-soft »

Die verwenden eindeutige GUIDS usw. Da würde ich die Finger von lassen. Ich lösche die immer und erstelle mir herkömmliche, die ich dahin verschieben kann, wo sie mir gefallen. Shit MSI-Installer.
PureBasic 5.73 LTS | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Nutella hat nur sehr wenig Vitamine. Deswegen muss man davon relativ viel essen.
Bild
Jilocasin
Beiträge: 665
Registriert: 13.05.2006 16:04
Kontaktdaten:

Beitrag von Jilocasin »

Hab da was zum Erstellen (von Danilo) gefunden:

Hier der Code:

Code: Alles auswählen


Procedure CreateShellLink(PATH$, LINK$, Argument$, DESCRIPTION$, WorkingDirectory$, ShowCommand.l, HotKey.l, IconFile$, IconIndexInFile.l) 
   CoInitialize_(0) 
   If CoCreateInstance_(?CLSID_ShellLink,0,1,?IID_IShellLink,@psl.IShellLinkA) = 0 
      
   Set_ShellLink_preferences: 
      
      ; The file TO which is linked ( = target for the Link ) 
      ; 
      psl\SetPath(@PATH$) 
      
      ; Arguments for the Target 
      ; 
      psl\SetArguments(@Argument$) 
      
      ; Working Directory 
      ; 
      psl\SetWorkingDirectory(@WorkingDirectory$) 
      
      ; Description ( also used as Tooltip for the Link ) 
      ; 
      psl\SetDescription(@DESCRIPTION$) 
      
      ; Show command: 
      ;               SW_SHOWNORMAL    = Default 
      ;               SW_SHOWMAXIMIZED = aehmm... Maximized 
      ;               SW_SHOWMINIMIZED = play Unreal Tournament 
      psl\SetShowCmd(ShowCommand) 
      
      ; Hotkey: 
      ; The virtual key code is in the low-order byte, 
      ; and the modifier flags are in the high-order byte. 
      ; The modifier flags can be a combination of the following values: 
      ; 
      ;         HOTKEYF_ALT     = ALT key 
      ;         HOTKEYF_CONTROL = CTRL key 
      ;         HOTKEYF_EXT     = Extended key 
      ;         HOTKEYF_SHIFT   = SHIFT key 
      ; 
      psl\SetHotkey(HotKey) 
      
      ; Set Icon for the Link: 
      ; There can be more than 1 icons in an icon resource file, 
      ; so you have to specify the index. 
      ; 
      psl\SetIconLocation(@IconFile$, IconIndexInFile) 
      
      
   ShellLink_SAVE: 
      ; Query IShellLink For the IPersistFile interface For saving the 
      ; shortcut in persistent storage. 
      If psl\QueryInterface(?IID_IPersistFile,@ppf.IPersistFile) = 0 
        ; Ensure that the string is Unicode. 
        mem.s = Space(1000) ;AllocateMemory(1,1000) 
        MultiByteToWideChar_(#CP_ACP, 0, LINK$, -1, mem, 1000) 
        ;Save the link by calling IPersistFile::Save. 
        hres = ppf\Save(@mem,#TRUE) 
        result = 1 
        ppf\Release() 
      EndIf 
      psl\Release() 
   EndIf 
   CoUninitialize_() 
   ProcedureReturn result 
    
   DataSection 
     CLSID_ShellLink: 
       ; 00021401-0000-0000-C000-000000000046 
       Data.l $00021401 
       Data.w $0000,$0000 
       Data.b $C0,$00,$00,$00,$00,$00,$00,$46 
     IID_IShellLink: 
       ; DEFINE_SHLGUID(IID_IShellLinkA,         0x000214EEL, 0, 0); 
       ; C000-000000000046 
       Data.l $000214EE 
       Data.w $0000,$0000 
       Data.b $C0,$00,$00,$00,$00,$00,$00,$46 
     IID_IPersistFile: 
       ; 0000010b-0000-0000-C000-000000000046 
       Data.l $0000010b 
       Data.w $0000,$0000 
       Data.b $C0,$00,$00,$00,$00,$00,$00,$46 
   EndDataSection 

EndProcedure 


; CreateLink 
;             - TARGET$ for the Link ("c:\PureBasic\purebasic.exe") 
;             - LINK$ - name of the Link ("c:\pb.lnk") 
;             - Argument$ for the target  ("%1") 
;             - Description$ = Description and Tooltip ("Start PureBasic") 
;             - Working Directory ("c:\PureBasic\") 
;             - Show command: #SW_SHOWNORMAL or #SW_SHOWMAXIMIZED or #SW_SHOWMINIMIZED 
;             - HotKey - no need to use this :) 
;             - IconFile + Index ( "c:\PureBasic\purebasic.exe" , 1 ) 


If CreateShellLink("D:\BASIC\PureBasic\purebasic.exe","c:\PB.lnk","","Pure FUN","D:\BASIC\PureBasic\",#SW_SHOWMAXIMIZED,0,"%SystemRoot%\system32\SHELL32.dll",12) 
  beep_(800,100) 
EndIf 

WinDir$ = Space(100): GetSystemDirectory_(WinDir$,100) 
If CreateShellLink(WinDir$+"\calc.exe","c:\CALC.lnk","","Calculator","",0,0,"%SystemRoot%\system32\SHELL32.dll",23) 
  beep_(800,100) 
EndIf
PS: Leider tut der Code auf 3.3 nich, also konnte ich ihn nicht ausprobieren... :(
Bild
Benutzeravatar
ts-soft
Beiträge: 22292
Registriert: 08.09.2004 00:57
Computerausstattung: Mainboard: MSI 970A-G43
CPU: AMD FX-6300 Six-Core Processor
GraKa: GeForce GTX 750 Ti, 2 GB
Memory: 16 GB DDR3-1600 - Dual Channel
Wohnort: Berlin

Beitrag von ts-soft »

Damit werden herkömmliche Shortcuts erstellt. Er möchte ja die anderen benutzen :freak:
PureBasic 5.73 LTS | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Nutella hat nur sehr wenig Vitamine. Deswegen muss man davon relativ viel essen.
Bild
Jilocasin
Beiträge: 665
Registriert: 13.05.2006 16:04
Kontaktdaten:

Beitrag von Jilocasin »

Ach so... :oops: :oops: :oops:
Bild
DarkDragon
Beiträge: 6291
Registriert: 29.08.2004 08:37
Computerausstattung: Hoffentlich bald keine mehr
Kontaktdaten:

Beitrag von DarkDragon »

Hab ich da nicht auch schon was gepostet?

Code: Alles auswählen

Structure ShellLinkInfo
  ;Longs
  IconIndex.l
  ShowCmd.l
  Hotkey_VK.l
  Hotkey_MOD.l
  
  ;Strings
  Target.s
  Description.s
  WorkingDirectory.s
  Arguments.s
  IconLocation.s
EndStructure

Procedure.l LowByte(Word.w)
  ProcedureReturn PeekB(@Word  )
EndProcedure

Procedure.l HighByte(Word.w)
  ProcedureReturn PeekB(@Word+1)
EndProcedure

Procedure GetShellLinkInfo(ShellLink.s, *p.ShellLinkInfo)
   Dim LinkFile.w(Len(ShellLink))
   MultiByteToWideChar_(#CP_ACP, 0, ShellLink, -1, LinkFile(), Len(ShellLink)) ;We need a WideChar version of the ShellLink.s
   
   *Buf = AllocateMemory(1024)
   Hotkey.w = 0
   
   Result = 0
   If *Buf <> 0
   CoInitialize_(0)
   If CoCreateInstance_(?CLSID_ShellLink,0,1,?IID_IShellLink,@psl.IShellLinkA) >= 0
     If psl\QueryInterface(?IID_IPersistFile, @ppf.IPersistFile) >= 0
       If ppf\Load(@LinkFile(), 1) >= 0 ;Icon loaded?
         
         ;Get the target
         psl\GetPath(*Buf, 1024, 0, 0)
         *p\Target = PeekS(*Buf)
         RtlFillMemory_(*Buf, 1024, 0)
         
         ;Get the description
         psl\GetDescription(*Buf, 1024)
         *p\Description = PeekS(*Buf)
         RtlFillMemory_(*Buf, 1024, 0)
         
         ;Get the working directory
         psl\GetWorkingDirectory(*Buf, 1024)
         *p\WorkingDirectory = PeekS(*Buf)
         RtlFillMemory_(*Buf, 1024, 0)
         
         ;Get the arguments
         psl\GetArguments(*Buf, 1024)
         *p\Arguments = PeekS(*Buf)
         RtlFillMemory_(*Buf, 1024, 0)
         
         ;Get the hotkey
         psl\GetHotkey(@Hotkey)
         *p\Hotkey_VK  = LowByte (Hotkey)
         *p\Hotkey_MOD = HighByte(Hotkey)
         
         ;Get the showcommand
         addr = *p
         psl\GetShowCmd(addr+4)
         
         ;Get the icon file and the icon index
         psl\GetIconLocation(*Buf, 1024, *p)
         *p\IconLocation = PeekS(*Buf)
         ;RtlFillMemory_(*Buf, 1024, 0) ;<- We don't need this here
         
         
         ;Result will be 1 because we have finished the processing
         Result = 1
       EndIf
       ppf\Release()
     EndIf
     psl\Release()
   EndIf
   CoUninitialize_()
   
   FreeMemory(*Buf)
   EndIf
   
   ProcedureReturn Result
   
   
   
   DataSection
     CLSID_ShellLink:
       ; 00021401-0000-0000-C000-000000000046
       Data.l $00021401
       Data.w $0000,$0000
       Data.b $C0,$00,$00,$00,$00,$00,$00,$46
     IID_IShellLink:
       ; DEFINE_SHLGUID(IID_IShellLinkA,         0x000214EEL, 0, 0)
       ; C000-000000000046
       Data.l $000214EE
       Data.w $0000,$0000
       Data.b $C0,$00,$00,$00,$00,$00,$00,$46
     IID_IPersistFile:
       ; 0000010b-0000-0000-C000-000000000046
       Data.l $0000010b
       Data.w $0000,$0000
       Data.b $C0,$00,$00,$00,$00,$00,$00,$46
   EndDataSection
   
EndProcedure

GetShellLinkInfo("C:\Dokumente und Einstellungen\Daniel\Desktop\Trillian.lnk", @SLI.ShellLinkInfo)
Debug SLI\Target
Debug SLI\Description
Debug SLI\WorkingDirectory
Debug SLI\Arguments
Debug SLI\IconLocation
Debug SLI\IconIndex
Angenommen es gäbe einen Algorithmus mit imaginärer Laufzeit O(i * n), dann gilt O((i * n)^2) = O(-1 * n^2) d.h. wenn man diesen Algorithmus verschachtelt ist er fertig, bevor er angefangen hat.
Antworten