Solved

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

Posted on 2001-09-18
17
155 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

705 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