title image


Smiley Wo ist nun genau das Problem..?
Bei mir geht es:





unit Unit1;



interface



uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls,

ShlObj,

ComObj,

ActiveX,

CommCtrl;

type

TForm1 = class(TForm)

Button1: TButton;

Memo1: TMemo;

procedure Button1Click(Sender: TObject);

private

{ Private-Deklarationen }

public

{ Public-Deklarationen }

end;



var

Form1: TForm1;



implementation



{$R *.dfm}





type

PShellLinkInfoStruct = ^TShellLinkInfoStruct;

TShellLinkInfoStruct = record

FullPathAndNameOfLinkFile: array[0..MAX_PATH] of Char;

FullPathAndNameOfFileToExecute: array[0..MAX_PATH] of Char;

ParamStringsOfFileToExecute: array[0..MAX_PATH] of Char;

FullPathAndNameOfWorkingDirectroy: array[0..MAX_PATH] of Char;

Description: array[0..MAX_PATH] of Char;

FullPathAndNameOfFileContiningIcon: array[0..MAX_PATH] of Char;

IconIndex: Integer;

HotKey: Word;

ShowCommand: Integer;

FindData: TWIN32FINDDATA;

end;



procedure GetLinkInfo(lpShellLinkInfoStruct: PShellLinkInfoStruct);

var

ShellLink: IShellLink;

PersistFile: IPersistFile;

AnObj: IUnknown;

begin

// access to the two interfaces of the object

AnObj := CreateComObject(CLSID_ShellLink);

ShellLink := AnObj as IShellLink;

PersistFile := AnObj as IPersistFile;



// Opens the specified file and initializes an object from the file contents.

PersistFile.Load(PWChar(WideString(lpShellLinkInfoStruct^.FullPathAndNameOfLinkFile)), 0);

with ShellLink do

begin

// Retrieves the path and file name of a Shell link object.

GetPath(lpShellLinkInfoStruct^.FullPathAndNameOfFileToExecute,

SizeOf(lpShellLinkInfoStruct^.FullPathAndNameOfLinkFile),

lpShellLinkInfoStruct^.FindData,

SLGP_UNCPRIORITY);



// Retrieves the description string for a Shell link object.

GetDescription(lpShellLinkInfoStruct^.Description,

SizeOf(lpShellLinkInfoStruct^.Description));



// Retrieves the command-line arguments associated with a Shell link object.

GetArguments(lpShellLinkInfoStruct^.ParamStringsOfFileToExecute,

SizeOf(lpShellLinkInfoStruct^.ParamStringsOfFileToExecute));



// Retrieves the name of the working directory for a Shell link object.

GetWorkingDirectory(lpShellLinkInfoStruct^.FullPathAndNameOfWorkingDirectroy,

SizeOf(lpShellLinkInfoStruct^.FullPathAndNameOfWorkingDirectroy));



// Retrieves the location (path and index) of the icon for a Shell link object.

GetIconLocation(lpShellLinkInfoStruct^.FullPathAndNameOfFileContiningIcon,

SizeOf(lpShellLinkInfoStruct^.FullPathAndNameOfFileContiningIcon),

lpShellLinkInfoStruct^.IconIndex);



// Retrieves the hot key for a Shell link object.

GetHotKey(lpShellLinkInfoStruct^.HotKey);



// Retrieves the show (SW_) command for a Shell link object.

GetShowCmd(lpShellLinkInfoStruct^.ShowCommand);

end;

end;



procedure TForm1.Button1Click(Sender: TObject);

const

br = #13#10;

var

LinkInfo: TShellLinkInfoStruct;

s: string;

begin

FillChar(LinkInfo, SizeOf(LinkInfo), #0);

LinkInfo.FullPathAndNameOfLinkFile := 'D:\Backup\Desktop\a.lnk';

GetLinkInfo(@LinkInfo);

with LinkInfo do

s := FullPathAndNameOfLinkFile + br +

FullPathAndNameOfFileToExecute + br +

ParamStringsOfFileToExecute + br +

FullPathAndNameOfWorkingDirectroy + br +

Description + br +

FullPathAndNameOfFileContiningIcon + br +

IntToStr(IconIndex) + br +

IntToStr(LoByte(HotKey)) + br +

IntToStr(HiByte(HotKey)) + br +

IntToStr(ShowCommand) + br +

FindData.cFileName + br +

FindData.cAlternateFileName;

memo1.Clear;

Memo1.Lines.Add(s);

s:= LinkInfo.FullPathAndNameOfWorkingDirectroy;

showmessage(S);

end;



end.





Damit funktioniert es 100%. Hast Du auch die Uses beachtet?

Gruß
~Mathias
..   ————————————————————————————————————————
..
..   Private Seite: http://www.nogad.de
..
..   ————————————————————————————————————————
..
..   Pension Fiege - Inhaber Monika Fiege
..   Kranichfelder Straße 68
..   99097 Erfurt
..
..   Tel: +49 361 41 38 39
..   Fax: +49 361 42 150 87
..
..   www.Pension-Fiege.de
..
..   ————————————————————————————————————————


geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: