TIP: Click on subject to list as thread! ANSI
echo: delphi
to: ALL
from: BRYAN SMITH
date: 1996-06-11 11:52:00
subject: Hello World

Thanks to Francois Piette for his "Hello World" post of 07 Jun 96.  It made
you think - which is what this echo is all about :-)
In my case, my FAX program has a problem - it incorrectly leaves the modem's
auto-answer enabled when it exits.  I was using a small .COM file to turn
off the auto-answer, but this was slow (it takes time to switch from Windows
to/from DOS) and it was ugly (the screen goes black while in DOS).  So I
wondered if I could build on Francois's example, dropping the Winprocs stuff
and adding in a few lines of assembler code.
The answer is a qualified yes.  The program compiles and runs as expected.
The qualification is that if you attempt to go to Options|Project, you get
your knuckles rapped for not having a "Uses" statement.  So if you don't
want to get hassled, you have to add a non-functional uses statement, e.g.
"Uses Winprocs ;".  Happily, this dummy statement has no effect on the size
of the resultant .exe file.
Here's a sketch of what the project file FIXMODEM.DPR looks like ...
----------------------------------------------------------------------
program FixModem;
{ Compiler itself does not demand a "uses", but a dummy one is required to }
{ keep the IDE happy ... }
uses
  WinProcs; { or any other unit, since this is a dummy ! }
const
  str : string[7] = 'ATS0=0'#13 ;
begin
  asm
    ... several lines of assembler code, using int 14h (the COM port
        interrupt) to send str to the modem ...
  end ;
end.
----------------------------------------------------------------------
The good news is that Delphi program FixModem.Exe is just 2495 bytes, and
that it runs in "zero" time without even making the screen blink.  The bad
news is that the equivalent .COM file was just 45 bytes.  Functionally, of
course, there is no difference in these sizes, since both will eat up the
whole of one allocation unit on the disk.
And in case anybody cares, here are the sizes of programs that contain NO
executable code ...
  Assembler   .COM,    2 bytes.  (Must have int 21h to stop it.)
  BP7         .EXE, 1632 bytes.
  Delphi 1.0  .EXE, 2442 bytes.
What is really important about Francois' example is the way it forces you to
realize that, deep down beneath all the mumbo jumbo of VCL's and point-
and-click programming, Delphi is at heart just another compiler:  and that
it can be used as such once you overcome any fear of altering the .DPR file.
--- PPoint 2.00
---------------
* Origin: Kingston, Canada (1:249/109.11)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.