?
Solved

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

Posted on 2001-09-18
17
Medium Priority
?
156 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
Industry Leaders: 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 400 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

770 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