3 easy problem i think, Help Help 
Author Message
 3 easy problem i think, Help Help

Hi

I hope you can help me.

1.How can i execute a dos program from my Delphi app.

2.How can i make a check for a fil, if is there.

3.My program make a ini file, but default is windows dir.
  How can i make it too save in the app dir (but not by default).
  I mean if it is on anothere pc, then it can by my dir.

Please type it clear, im not new, but im not good at this.

S{*filter*} B.



Thu, 31 Dec 1998 03:00:00 GMT
 3 easy problem i think, Help Help



Quote:
>2.How can i make a check for a fil, if is there.

Use FileExists(Filename).

Quote:
>3.My program make a ini file, but default is windows dir.
>  How can i make it too save in the app dir (but not by default).

Try this:
MyINI := TINIFile.Create(ExtractFilePath(Application.ExeName) + 'MyApp.ini');

ExtractFilePath(Application.ExeName) will give you the directory that your
program was run from.

Good luck,

  David

--
David Weisberger



Fri, 01 Jan 1999 03:00:00 GMT
 3 easy problem i think, Help Help


Quote:
> Path: iafrica.com!pipex-sa.net!plug.news.pipex.net!pipex!tank.news.pipex.net!pipex!news.mathworks.com!zombie.ncsc.mil!nntp.coast.net!news00.sunet.se!sunic!mn6.swip.net!mn5.swip.net!news

> Newsgroups: comp.lang.pascal.delphi.databases
> Subject: 3 easy problem i think, Help Help
> Date: Sun, 14 Jul 1996 18:53:04 +0200
> Organization: Privat
> Lines: 15

> NNTP-Posting-Host: dialup106-1-2.swipnet.se
> Mime-Version: 1.0
> Content-Type: text/plain; charset=iso-8859-1
> Content-Transfer-Encoding: 8bit
> NNTP-Posting-User: 033aeff23ec8c2ee257f2d2216560894
> X-Mailer: Mozilla 2.0 (Win95; I)

> Hi

> I hope you can help me.

> 1.How can i execute a dos program from my Delphi app.

> 2.How can i make a check for a fil, if is there.

> 3.My program make a ini file, but default is windows dir.
>   How can i make it too save in the app dir (but not by default).
>   I mean if it is on anothere pc, then it can by my dir.

> Please type it clear, im not new, but im not good at this.

> S{*filter*} B.

To execute a dos program I created a PIF file useing windows PIF editor.  I
then used the delphi windows command WINEXEC ('\dir\dir2\exec.exe', SW_????) ;

To check for files use the FILEEXISTS ('\dir\dir2\file.txt') ; command.  It
returns True or False ;



Fri, 01 Jan 1999 03:00:00 GMT
 3 easy problem i think, Help Help

Quote:

>2.How can i make a check for a fil, if is there.

From the Delphi v2.0 Help file:

Declaration

function FileExists(const FileName: string): Boolean;

Description

The FileExists function returns True if the file specified by FileName
exists. If the file does not exist, FileExists returns False.

Quote:
>3.My program make a ini file, but default is windows dir.
>  How can i make it too save in the app dir (but not by default).
>  I mean if it is on anothere pc, then it can by my dir.

For an executable, 'Application.EXEName' contains the full path and
file name of the executable. What I do is use a small function that I
maintain in my set of "stock" units called GetDirectory. I pass the
EXEName property to the function, which simply steps backward through
the string until it hits a backslash, then returns
'COPY(InputString,1,BackslashPosition). You can use that return value
as the location for the program-specific .INI file (e.g.,
"INIFile.Create(ProgramDirectory+'XXX.INI')", where ProgramDirectory
is the return value from the GetDirectory function).

I hope this has been both helpful and clear (but I'd prefer helpful!)

H.B. Taylor



Sat, 02 Jan 1999 03:00:00 GMT
 3 easy problem i think, Help Help


Quote:

[snip]
> For an executable, 'Application.EXEName' contains the full path and
> file name of the executable. What I do is use a small function that I
> maintain in my set of "stock" units called GetDirectory. I pass the
> EXEName property to the function, which simply steps backward through
> the string until it hits a backslash, then returns
> 'COPY(InputString,1,BackslashPosition). You can use that return value
> as the location for the program-specific .INI file (e.g.,
> "INIFile.Create(ProgramDirectory+'XXX.INI')", where ProgramDirectory
> is the return value from the GetDirectory function).

Psst!  Here's a little secret, ExtractFilePath(Application.EXEName) will
do all that for you.  No fuss, no muss...

--
David S. Becker
ADP Dealer Services (Plaza R&D)

(503)402-3236



Sun, 03 Jan 1999 03:00:00 GMT
 3 easy problem i think, Help Help

Quote:

>Hi
>2.How can i make a check for a fil, if is there.

Look up the "FileExists()" function in the helpfiles.

Regards,

Tomas
-----------------------------------------------------
 Tomas Matuschek
 University of Vaxjo, Sweden
-----------------------------------------------------



Wed, 28 Apr 1999 03:00:00 GMT
 
 [ 6 post ] 

 Relevant Pages 

1. help,help,help,help,help,help,help,help,help,help,help,help,help,

2. An easy problem, I Think...

3. Q: help - TNS problems, I think

4. Q: help - TNS problems - I think

5. Help,Help,Help,Help,Help,Help,Help,Help,Help,Help,Help,Help,Help,Help,Help,Help,Help,Help,

6. help help help help help help help help help

7. Easy Urgent Query Problem HELP!!

8. Please help for an easy problem !

9. Easy query problem, quick help needed please.

10. Easy Problem...Can Somebody Help??

11. Need help with easy problem

12. SQL-PROBLEMS - EASY FOR YOU - PLEASE HELP....


 
Powered by phpBB® Forum Software