Solved

Where is my EXE etc.

Posted on 1999-01-24
15
164 Views
Last Modified: 2010-04-06
How can I tell which directory a user has copied my programme and any associated files.
Bearing in mind no changes to registry or system settings etc. I did have this information but unfortunately problems with my computer means I have lost a hell of a lot of info.

xpher
0
Comment
Question by:xpher
  • 4
  • 3
  • 3
  • +4
15 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1363071
Hi xpher,

your program-Path and name of exe you can get with ParamStr(0)

i.e. edit1.text := paramStr(0);

for the other files you have to write a search-algorythm or protocoll it in an INI-File, if you use a InstallationRoutine.

meikl
0
 

Expert Comment

by:dr_gonzo
ID: 1363072
Use ExtractFilePath(ParamStr(0))
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1363073
Hi Dr. Gonzo,

how about reading the comments before answering questions???
I mean it's the second question today, where I see you posting an answer with not (at least significantly) more info than some other experts have given before you in comments...

Regards, Madshi.
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 1

Author Comment

by:xpher
ID: 1363074
Well said Madshi

kretzschmar can you post an answer it was enough to jog my memory banks.

Regards

xpher
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1363075
You can also use ExtractFilePath(Application.ExeName)...

Cheers,

Raymond.
0
 
LVL 1

Author Comment

by:xpher
ID: 1363076
Thanks rwilson I'll try that one. My other problem is sorted but many thanks.

xpher :)
0
 
LVL 1

Expert Comment

by:martin_g
ID: 1363077
If you don't know where the file(s) may be "hiding" you'll need a file finding algorithm.
Here's a rudimentary file find routine you can use. It's not original but the author published the component as freeware
Gabriel Cherem  E-mail egr7jmc@npd.ufsc.br
procedure TFileFind.SearchDirectory(FileMask:String; Path: TFileName);
function MakePath(Path,FileName:TFileName):TFileName;
begin
  Result := Path;
  if Result[Length(Result)] <> '\' then
    Result := Result + '\';
  Result := Result + FileName;
end;

var
  SearchRec: TSearchRec;
begin
  if Assigned(FOnChangeDirectory) then
    FOnChangeDirectory(Self,Path);
  { one pass for files... }
  if FindFirst(MakePath(Path,FileMask), faAnyFile, SearchRec) = 0 then
    repeat
      with SearchRec do
        if Attr <> faDirectory then begin
          FLastMatch := MakePath(Path,Name);
          if Assigned(FOnMatch) then
            FOnMatch(Self);
          if StopOnFirstMatch then
            Stopped := true
          else
            Application.ProcessMessages;
       end
      until (FindNext(SearchRec) <> 0) or Stopped;
  FindClose(SearchRec);
  { ... and another for subdirectories }
  if (SearchScope <> ssCurrentDir) or Stopped then begin
    if FindFirst(MakePath(Path,'*.*'), faDirectory, SearchRec) = 0 then
      repeat
        with SearchRec do
          if (Name <> '.') and (Name <> '..') and (Attr = faDirectory) then
            SearchDirectory(FileMask,MakePath(Path,Name));
        Application.ProcessMessages; { we have to be gentle to the others apps }
      until (FindNext(SearchRec) <> 0) or Stopped;
    FindClose(SearchRec);
  end;
  { these two loops above could become just one, but i'd  }
  { have to write a parser to resolve wildcards...        }
  { I will be gratefull if someone send me one! :)        }
end;

Hope this helps!
Martin Gauss
0
 

Expert Comment

by:dr_gonzo
ID: 1363078
Hi Madhsi.
I always thought this place was were you helped each other,
and that fighting belonged to newsgroups.
There's a difference between comments and answers if you ask me.
I post a comment, if it is an answered out of my mind but I haven't been able to test it.

If I have test it I post it as an answer. An answer should be completely right, not half the way.
If the person asking the question does like a comment better he can do what xpher did. reject my answer and let you get the points. Thats the way it should be if your hint helped him to solve the problem. I do not have anything to say against that.

But that you here instead of in my mail acuse me of steeling point I get really mad.

So I think I can delight you and xpher. I will not use EE for anything else than my questions. I don't want to fight. Maybe someone know some good place for helping each other?

\Dr. Gonzo
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 20 total points
ID: 1363079
well xpher,

i will post this as answer, but if you like to follow the discussion or you want to get a searchalgorythm, then reject my answer.

meikl

0
 
LVL 20

Expert Comment

by:Madshi
ID: 1363080
Hi Dr. Gonzo,

I didn't mean to fight or to insult you in any way. Sorry, if you understood it this way...  :-(

I was not angry because you answered the question, but because you didn't seem to read the comments of the other experts. You must admit that your answer was not significantly better than meikl's comment was. So it was unfair to post an answer. Of course xpher could reject your answer and give meikl the points (and you see that he agrees with me here). But unfortunately a lot of questioners would just have accepted your answer. And that would have been quite unfair to meikl, since he was faster than you. I don't know why he didn't post an answer. I guess he was so polite to give xpher the possibility to check his comment before locking the question.

All I want is that you *please* read the comments before locking a question. Then if you think your answer is right and nobody else has given the same info before you (!) you should of course post an answer. Don't you think that this would be a better? Thank you...

Regards, Madshi.
0
 

Expert Comment

by:dr_gonzo
ID: 1363081
Yes. But I'm still of the opinion that his answer was a hint,
and my was an answer. Of corse if the hint was enough hi should have the point. I also believe that the questioner's are professional enough to not give points to someone who should get them. After all they are experts. So my answer has to be no i don't think that's better. Anyway this point system is kind of sick anyway, so i guess I have to set up my own newsgroup or something. byw for now...

Anyway thanks for not insulting me. :->

Regards,
Dr. Gonzo
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1363082
Hi Madshi, hi dr_gonzo,

i do principal a possible answer in a comment, so that the questioner can evaluate it. But not all questioner are professional enough to see that a comment is closer to the solution than a answer. It happens to me often that the questioner commented that my comment had solved his problem and he accepts a answer from a other Expert (Frusted).

But i'm not here to cellect Points, of course i am afraid about given points to me, it's for Fun, for my Brain, for helping others, for learning from others.

meikl :-)
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1363083
:-)

I do agree with you, except this point:
>> I also believe that the questioner's are professional enough
>> to not give points to someone who should get them.

Fortunately, a lot of questioners are professional enough. But believe me, a lof of questioners are NOT! It happended several times to me, that other experts posted the same answer (or even a worse) as I've written in a comment before - and nevertheless got "my" points. Of course, it's not so important (we can't buy anything with the points), but it's somehow a little bit frustrating...
That's why I sometimes get angry about experts who don't seem to read the comments...

Regards, Madshi.
0
 
LVL 3

Expert Comment

by:philipleighs
ID: 1363084
You can "buy" an EE t-shirt with 5000 expert points, and you even get to keep the points! I'm wearing mine right now.

See http://www.experts-exchange.com/info/tshirt.htm

0
 
LVL 20

Expert Comment

by:Madshi
ID: 1363085
Hi Philip, thank you for the tip...   :-)
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

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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

816 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

12 Experts available now in Live!

Get 1:1 Help Now