Building console application

How I can build a console application via HMG ?

We have a paradox here: though HMG is a GUI library, we are requesting a non-GUI service; since console means non-GUI.

But don’t wory, this is possible; even very easy, such as any HMG application, and with more than one method.

Method 1: Batch processing:

( Assuming HMG root folder is C:\hmg and name of your console application project file name is ConsOnly.HbP and your main prg file name is ConsOnly.Prg )

call c:\hmg\build.bat /c ConsOnly

( No matter ConsOnly is a project or program file. )

If your project has more than one .prg file, you may use build.bat such ways:

1- call c:\hmg\build.bat /c progr1 progr2 prog3 ...

.OR.

2- First build a .hbp file contains such as:

progr1
progr2
prog3

and say name is “ConsOnly.Hbp” then invoke build.bat:

call c:\hmg\build.bat /c ConsOnly

The /c ( or /C ) switch inform build.bat about console.

You can omit this switch, by adding this line to top of your .prg file:

REQUEST HB_GT_WIN_DEFAULT

Method 2: Via HMG-IDE:

First you need add abowe

REQUEST HB_GT_WIN_DEFAULT

line to top of your .prg file.

And then, building a project file ( .hbp ). For example if your .prg file name is ConsOnly.prg, you may use a ConsOnly.HbP  file contains one line:

ConsOnly.prg

If your project has more than one .prg file, your project file contains a list of that .prg files. For example:

progr1
progr2
prog3

You may build this project file simply writing with a text editor or by selecting “New Project” within HMG-IDE.

And only thing is pressing “Run” button.

Yo don’t need any other thing.

Caution:

Don’t include

#include <hmg.ch>

line into console-only .prg’s.

Technically no problem, you can add. Moreover with this  way, though project is console mode,   you can see error messages in GUI mode. But has a risk: may be some HMG functions have same names with Harbour and if you include “hmg.ch”, HMG functions will override others; an example may be  BROWSE(). If this is your intend,  no problem. But this situation sometime may be a nightmare.

One response to “Building console application

  1. Pingback: How I can build … | Viva Clipper !

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.