Solved

*.lnk file's how to.. need help

Posted on 2001-09-18
17
151 Views
Last Modified: 2010-04-06
hello,
i got a problem i what to read a link file<- like portition's or how to make i need help maybe anny one got a exmanple  i'm makeing a ftp server and client and i whant to cotrol the link file's.
is it posible..?

plz respone with verything you know about it.

Carlos smith

already thanx for helping.
0
Comment
Question by:krydea
  • 8
  • 6
  • 2
  • +1
17 Comments
 
LVL 1

Expert Comment

by:Fraction
ID: 6491453
Take a look at this excelent site:
http://www.wotsit.org/
0
 
LVL 8

Expert Comment

by:Cesario
ID: 6491454
Hi Carlos,

uses ComObj, ActiveX und ShlObj

procedure ShowTarget(LinkFile : WideString);
var IU : IUnknown;
    SL : IShellLink;
    PF : IPersistFile;
    FindDate : TWin32FindData;
    TargetFile : array[0..MAX_PATH] of char;
begin
// Create IShellLink und IPersistFile to access the .LNK-Datei. }
  IU := CreateComObject(CLSID_ShellLink);
  SL := IU as IShellLink;
  PF := SL as IPersistFile;
// Load the .LNK-File in the IPersistFile Objekt .
  PF.Load(PWideChar(LinkFile), STGM_READ);
// Resolve the Link
  SL.Resolve(0, SLR_ANY_MATCH or SLR_NO_UI);
// read the info
  SL.GetPath(TargetFile, MAX_PATH, FindDate, SLGP_UNCPRIORITY);
// Output  ShowMessage(TargetFile);
end;

Best Regards

Cesario
0
 
LVL 6

Expert Comment

by:edey
ID: 6491460
Here's an example I grabbed from a usenet article sometime ago:

uses

  ShlObj, ActiveX, ComObj, Registry;

procedure TForm1.Button1Click(Sender: TObject);
var
  MyObject  : IUnknown;
  MySLink   : IShellLink;
  MyPFile   : IPersistFile;
  FileName  : String;
  Directory : String;
  WFileName : WideString;
  MyReg     : TRegIniFile;
begin
  MyObject := CreateComObject(CLSID_ShellLink);
  MySLink := MyObject as IShellLink;
  MyPFile := MyObject as IPersistFile;
  FileName := 'NOTEPAD.EXE';
  with MySLink do begin
    SetArguments('C:\AUTOEXEC.BAT');
    SetPath(PChar(FileName));
    SetWorkingDirectory(PChar(ExtractFilePath(FileName)));
  end;
  MyReg := TRegIniFile.Create(
    'Software\MicroSoft\Windows\CurrentVersion\Explorer');

// Use the next line of code to put the shortcut on your desktop
  Directory := MyReg.ReadString('Shell Folders','Desktop','');

// Use the next three lines to put the shortcut on your start menu
//  Directory := MyReg.ReadString('Shell Folders','Start Menu','')+
//      '\Whoa!';
//  CreateDir(Directory);

  WFileName := Directory+'\FooBar.lnk';
  MyPFile.Save(PWChar(WFileName),False);
  MyReg.Free;
end;


GL
Mike
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:krydea
ID: 6493560
thanx pepole who what's the point's?
umm,
i don't got more point's on E.E so i'm asking for someone could plz help.. how can i get form ksbgfksb.lnk or kjfdshkbf.exe the expretion like exe or lnk? plz help......
0
 
LVL 6

Expert Comment

by:edey
ID: 6493711
Hi krydea, I would think that they would belong to Cesario  :).

GL
Mike
0
 
LVL 6

Expert Comment

by:edey
ID: 6493715
He beat me with an example by 2:00 -- oooh you're quick cesario :)

GL
Mike
0
 

Author Comment

by:krydea
ID: 6493736
k i will do that!
edey : can you plz help me with this just for frendship?:
i don't got more point's on E.E so i'm asking for someone could plz help.. how can i get form ksbgfksb.lnk
or kjfdshkbf.exe the expretion like exe or lnk? plz help......
0
 
LVL 6

Expert Comment

by:edey
ID: 6493767
I would be happy to help you with something - I'm just not sure what you're asking for.  Perhaps, are you looking for the file name extension - if file name ends with '.exe' or '.lnk'?  If this is so you can use the extractFileExt function.

GL
Mike
0
 

Author Comment

by:krydea
ID: 6493783
is that's how you can get easy form a file name to expantion?
0
 
LVL 6

Expert Comment

by:edey
ID: 6493905
I'm really sorry, we seem to have some communication challenges. I'm not sure if this is what you want but this is what extractFileExt does:

extractFileExt('c:\autoexec.bat') = '.bat'
extractFileExt('c:\windows\desktop\foo.lnk') = '.lnk'
extractFileExt('c:\windows\win.com') = '.com'

Is this what you need? If not could you try explaining again?  Again, I am sorry.

GL
Mike
0
 

Author Comment

by:krydea
ID: 6494037
thanx thanx thanx thanx that is it:)
0
 
LVL 6

Expert Comment

by:edey
ID: 6494146
Excellent, Glad to be of service :)

GL
Mike
0
 
LVL 8

Accepted Solution

by:
Cesario earned 100 total points
ID: 6494161
Hi krydea,

we are glad to help you.

Best Regards

Cesario
0
 

Author Comment

by:krydea
ID: 6494250
thanx mate's
0
 

Author Comment

by:krydea
ID: 6497091
(Edited by Computer101)..
Cesario: i'm using your example but you did not put how to get to witch file it gos only with programme he uses.. can you plz help me with that to?
0
 

Author Comment

by:krydea
ID: 6497277
sorry i got that but what if you whant to put a sort cut in c:\ how can i do that? change the deskt top does not work...?
0
 

Author Comment

by:krydea
ID: 6497285
sorry again i got it that thanx sorry thanx
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
delphi parse string to params 3 137
Delphi Yen format 3 45
SUM 2 INTEGER ARRAYS INTO 1 10 108
How to make Sign in, using Clientdataset? 1 28
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question