Using Pascal in Windows: Shortcuts & Opening Files 
Author Message
 Using Pascal in Windows: Shortcuts & Opening Files

I have two questions which I have found no answers or examples of on the
internet or in turbo Pascal guides. I would be grateful for any help with
these problems.

Question 1 : Is it possible to create shortcuts for programs with turbo
Pascal. I have seen shortcuts with extensions '.lnk' and '.pif', is it
possible to make either of these. This may not be possible because Pascal is
a dos compiler but I am unsure.

Question 2 : Is it possible to open files in turbo Pascal which are windows
files such as notepad. I know that the Exec command can be used to open
msdos files. Is there a way of doing this.

Any help with either of these questions would be appreciated. Thank you for
reading this post.

Andrew.



Wed, 18 Jun 1902 08:00:00 GMT  
 Using Pascal in Windows: Shortcuts & Opening Files

Quote:
> I have two questions which I have found no answers or examples of on the
> internet or in turbo Pascal guides. I would be grateful for any help with
> these problems.

> Question 2 : Is it possible to open files in turbo Pascal which are
windows
> files such as notepad. I know that the Exec command can be used to open
> msdos files. Is there a way of doing this.

I did not try to open notepad, but this works with starting Outlook Express

 {************************************************}
{                                                }
{ Turbo Exec Demo                                }
{ Copyright (c) 1985,90 by Borland International }
{                                                }
{************************************************}

program ExecDemo;

(*
  Demonstration program that shows how to use the Dos
  unit's Exec procedure to execute DOS commands (including
  running other programs or batch files).

  This program keeps prompting you for a DOS command until
  you enter a blank line.

  When using Exec, make sure you specify a {$M} directive
  so the heap leaves some memory available for the child
  process.
*)

{$M 8192,0,0}           { Leave memory for child process }

uses Dos;
var
  Command: string[127];
begin
{If you enter: "c:\program files\outlook express\msimn.exe"
                    Outlook Express starts - provided that is where OE is
located...
                    and be sure to use the quotation " " marks

                   ... this works for DOS commands and other executable
files
                   depending on the size of the file (and I'm sure other
factors)

Quote:
}

  repeat
    Writeln('(press ENTER to stop)');
    write(' Enter DOS command: ');
    ReadLn(Command);
    if Command <> '' then
    begin
      SwapVectors;
      Exec(GetEnv('COMSPEC'), '/C ' + Command);
      SwapVectors;
      if DosError <> 0 then
        WriteLn('Could not execute COMMAND.COM');
      WriteLn;
    end;
  until Command = '';
end.

Bill Vergos



Wed, 18 Jun 1902 08:00:00 GMT  
 Using Pascal in Windows: Shortcuts & Opening Files
Back to tell you that YES - Wordpad can be accessed using the procedure
below.  You just have to be sure that you input the correct path to
Wordpad.exe

On my computer the correct input is:
"C:\program files\accessories\wordpad.exe"  (remember to use quotation " "
marks)

Bill Vergos

Quote:

> program ExecDemo;

> {$M 8192,0,0}           { Leave memory for child process }

> uses Dos;
> var
>   Command: string[127];
> begin
>   repeat
>     Writeln('(press ENTER to stop)');
>     write(' Enter DOS command: ');
>     ReadLn(Command);
>     if Command <> '' then
>     begin
>       SwapVectors;
>       Exec(GetEnv('COMSPEC'), '/C ' + Command);
>       SwapVectors;
>       if DosError <> 0 then
>         WriteLn('Could not execute COMMAND.COM');
>       WriteLn;
>     end;
>   until Command = '';
> end.



Wed, 18 Jun 1902 08:00:00 GMT  
 Using Pascal in Windows: Shortcuts & Opening Files

Quote:

> Question 1 : Is it possible to create shortcuts for programs with turbo
> Pascal. I have seen shortcuts with extensions '.lnk' and '.pif', is it
> possible to make either of these. This may not be possible because Pascal is
> a dos compiler but I am unsure.

Of course it is: see www.wotsit.org for details about file formats.

Wolf



Wed, 18 Jun 1902 08:00:00 GMT  
 Using Pascal in Windows: Shortcuts & Opening Files

Quote:

> Back to tell you that YES - Wordpad can be accessed using the procedure
> below.  You just have to be sure that you input the correct path to
> Wordpad.exe

> On my computer the correct input is:
> "C:\program files\accessories\wordpad.exe"  (remember to use quotation " "

On some original windows CD (95,98 or NT, can't remember) a program
shortcut.exe exists, which accepts two parameters which creates a
shortcut.

Use the EXEC way (in the other messages in this thread) to create the
link from pascal.



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Using Pascal in Windows: Shortcuts & Opening Files

2. Informix windows SE too many files open

3. File-Open under windows 32

4. How to create a Windows shortcut?

5. TPW file open problem with Windows NT

6. Use pascal to open the bmp, jpg or gif files???( not attach file one)

7. Use pascal to open the bmp,jpg or gif file???( not attach file one)

8. D3 & BDE: Too many files open erro

9. opening a file that is already open in another app

10. File Open Error when I open too many time the same form

11. No more files under Windows NT while using BDE

12. Using Windows .FON files from BP???

 

 
Powered by phpBB® Forum Software