Solved

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

Posted on 2001-09-18
17
149 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
 

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now