Solved

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

Posted on 2001-09-18
17
150 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

785 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