Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text Based (DOS) App

Status
Not open for further replies.

ThunderForest

IS-IT--Management
Mar 3, 2003
189
US
Delphi 4.0

Is it possible to develop a DOS app, ie, no form, no gui? Reason I ask is that I'm beginning an RF project. The scanners are DOS based and I have WaveLink Studio. I purchased WaveLink because I was told I can use Delphi with it. It came with a type library, with what seems to be the functions I need to develop a menu and input system. The program would run as a service on an XP box. Apparently, such a program can be developed using VB by creating a "module". I've always developed Windows apps with Delphi. If this is stupidity, forgive me. Can anyone point me in the right direction?

Getting answers before I'm asked
is why I go to Tek-Tips.
 
Hi,

choose in the delphi menu 'file' and then 'new' and then 'other'
there you can choose 'service'.

there's a good deal explained about services in delphi help.

cheers

--------------------------------------
What You See Is What You Get
 
I think what you want to create is a "console application". Here is what the Delphi 6 help has to say. I imagine there may not be a File|New|Other->Console Application. But if you search the Delphi 4 help for "console application" then it should lead you in the right direction.
HelpFile said:
Console applications are 32-bit programs that run without a graphical interface, usually in a console window. These applications typically don’t require much user input and perform a limited set of functions.
To create a new console application,

1 Choose File|New|Other and select Console Application from the New Items dialog box.

Delphi then creates a project file for this type of source file and displays the code editor.

Note: When you create a new console application, the IDE does not create a new form. Only the code editor is displayed.

Console applications should handle all exceptions to prevent windows from displaying a dialog during its execution. For example, your application should include exception handling such as shown in the following code:

program Project1;

{$APPTYPE CONSOLE}
begin
try
raise exception.create('hi');
except
WriteLn('exception occurred');
end;
end.

Clive [infinity]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer."
Paul Ehrlich
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
JDonnewald wrote:
"The program would run as a service on an XP box"

this is clearly a service to me...

--------------------------------------
What You See Is What You Get
 
<sheepishly>
Sorry whosrdaddy - I didn't read the post properly, which is quite out of character for me!
</sheepishly>

Clive [infinity]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer."
Paul Ehrlich
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
now the answer to the question :

you'll need to create a Tservice object. (don't remember if delphi4 included an IDE wizard to create the service.

the unit code should look like this :

Code:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs;

type
  TService1 = class(TService)
    procedure ServiceExecute(Sender: TService);
  private
    { Private declarations }
  public
    function GetServiceController: TServiceController; override;
    { Public declarations }
  end;

var
  Service1: TService1;

implementation

{$R *.DFM}

procedure ServiceController(CtrlCode: DWord); stdcall;
begin
  Service1.Controller(CtrlCode);
end;

function TService1.GetServiceController: TServiceController;
begin
  Result := ServiceController;
end;

procedure TService1.ServiceExecute(Sender: TService);
begin
 while not terminated do
  begin
   // do stuff here
  end;
end;

end.

--------------------------------------
What You See Is What You Get
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top