HMG-IDE In Short

HMG-IDE Harbour MiniGUI Integrated Development Environment is a comprehensive and highly sophisticated project management utility. It is also extremely facilitated to easily use.

It’s possible to build and manage an entire project from scratch under this utility; without needing cryptic batch command ( .bat ) file, without interesting endless compiler / linker switches, etc.

HMG-IDE is more than a project maker :

  •  A clever form editor
  •  A database files ( Tables ) manager
  •  A report builder / editor


HMG-IDE come as two flawor : ANSI and Unicode versions. Dont worry about it, this two version works almost exectly same; only difference is Unicode supoort. You may use either depending on either your need to Unicode or not.

HMG-IDE has four part :

Control Panel : This main window is constituted on a menu bar and a tool box, having many command buttons with descriptive tool tips.

Project Browser : You can view, select and inspect all project elements in this window. henever you add or exclude a project element (module (program source file), form, resource, report …), IDE automatically updates the project browser.

Object Inspector : This window is for view and change properties and events of GUI elements in your forms.

Form design board : A chalk board for designing forms and directing its graphical elements.


Quick Start to Migration

Chapter I – Text to text conversion

In Clipper world, “migration” means “convert a DOS based Clipper program to Windows”. This is a dream of every Clipper – DOS programmer.

 Before all, we need clarify some terms:

May be found multiple ways for convert a DOS based Clipper program to Windows. In general, DOS programs are runs in “text” mode and Windows program runs in “Graphic” mode; and this is what meant by term “migration”.

Converting a text mode program to directly GUI (Graphical User Interface) is a painful job. First, we need to find a Compiler with GUI support, or a GUI library usable with a specific compiler. If we have more than one opportunity ( yes, it is so ) we need make a choice between them.

For make a right selection we need learn, understand specialties of each option and differences between them.

Believe me, this is an endless way 😦

Instead, let’s begin with simpler thing: convert a DOS text mode program to Windows text mode program.

Question: Without GUI, what meaning will be to migrate from DOS to Windows?

Answer: Good question and like all good question, answer isn’t easy.

First, modern OSs moves away day to day from DOS conditions; memory problems, screen problems, codepage problems, etc… By the time, building / running 16 bit executable becomes more difficult day to day.

Whereas Harbour already is a 32 / 64 bit compiler.

Second, all DOS Compilers for Clipper are commercial and registration required products; furthermore they are almost out of sold for this days; what compiler you could use?

And third, Harbour is best free compiler and the best way to use a free GUI tool for xBase language.

So, beginning with using Harbour in text mode is the best start point, I think.

First step is downloading and install HMG or Harbour. If you didn’t past this step yet please refer previous articles in this section or “Links” page of this blog.

The easiest way for using Harbour compiler is calling hbmk2, the wonderful project maker for Harbour compiler.

Depending your installation, hbmk2 may be in different locations; such as C:\Harbour\bin or c:\hmg\harbour\bin or anything else.

Hereafter I will assume that your hbmk2 is in C:\hmg\Harbour\bin. If your installation is different, please modify above examples.

Second step is assign an empty folder (directory) for work / test affairs; say C:\test.

And the third step is copying your Clipper program(s) to this folder.

But don’t rush; we have some precautions:

– Better way is starting with a single-program project; if you haven’t written a new one. Don’t uses for now projects have multiple program file.

 – Your program may have some “national” characters and these characters may be differently shown between DOS and Windows. If so, you may want fix manually these differences via a Windows based text editor. Or use a program if you have one. Harbour has a clever tool (HB_OEMTOANSI() function) is usable for this purpose.

 – In Clipper it’s possible a program file without module (procedure / function) definition. If you have such file(s), enclose your code with PROCEDURE — RETURN statement pair.

– Every Harbour project must have one and only one MAIN module (procedure / function). The first procedure / function in your single program file will be considered as MAIN module of your project. (In HMG, name of this module must be “main” also).

– Almost all Clipper commands, statement, functions, pseudo functions, manifest constants etc are usable almost in the same ways with Clipper. May be exist some very few and very rare differences, and of course solving methods for its.

For compile process we will use command box (DOS / console window) of Windows. You can open a console window, with the menu Start -> Run -> cmd or selecting it in the “Command Prompt” from the Start Menu \ All Programs.

 – “Command / console window” size may not appropriate for easy use. You may

      – use a MODE ( DOS ) command :

         MODE CON LINES=54 COLS=148


   – adding a SetMode() statement at the beginning of MAIN module of your project. For example:

       SetMode( 25,  80 )  // 25 line 80 column same as standard 
                           // DOS screen ( but not full screen ! )
       SetMode( 48, 128 )  // 48 line 128 column, may be more readable

Now, we are ready to begin: Enter this command in console window :

 C:\hmg\harbour\bin hbmk2 <mainPrgName>

You don’t need any SET command (such as PATH etc) before this command; hbmk2 will find all necessary paths / files.

For running executable after compile, add a -run switch to the command line :

 C:\hmg\harbour\bin hbmk2 <mainPrgName> -run

Of course, you need supply name of your main .prg file in place of <mainPrgName>.

Note that you don’t need a separate “linking” step; hbmk2 will do everything for you.

You may use this

 C:\hmg\harbour\bin hbmk2 <mainPrgName>

command via a batch ( .bat ) command file (such as “build.bat”) too. In this way you can apply compiling process without console window; run .bat file by double click in the Windows Explorer. In this case you may need add a PAUSE command at end of .bat file.

That’s all.

You know, a program file may contains more than one module (procedure / function). So you may develop your project by adding new modules to your single program file.

In this step you don’t need trying extra features, extensions of Harbour. Before that adventure your primary need is to convert existing project Clipper to Harbour.

When you reach a level of multiple-program file project:

– Basic rules are the same: the first module in the your program file is MAIN module of your project.

If your .prg files contains:

  SET PROCEDURE TO <procedure_File_Name>

 and / or

   #include <procedure_File_Name>

 you may or may not continue using these statement.

 – The shortest way for compiling a multiple-file project is use a .hbp ( Harbour Projet ) file. This is a text file and its simplest form is a file contains list of your .prg files. For example:


and the compile command is the same :

  C:\hmg\harbour\bin hbmk2 <mainProjectFileName>

In this case you don’t need to use SET PROC… and #include … statement and this is the better way.

Because hbmk2 applies “incremental” compiling, that is compiles only modified files.

Under normal circumstances, any module in any program file is callable in anywhere in the project. If you have some modules that exclusive to this program file, you may use STATIC keyword at the beginning of PROCEDURE / FUNCTION statement. For example:


With this syntax you will prevent calling this module outside of this .prg file and the possibility of using this module name into other .prg files.

Example :

Take “A typical Harbour Program” in the “Harbour Sample” page.

As seen at .pdf file by given link, this sample program borrowed from official reference guide of a Clipper compiler. That is, in fact this is a Clipper program and it will may compile with Harbour and run without any modification.

Let’s try.

– Copy and paste this sample and save in your PC with a name say “typical.prg”.

– Comment out the line for now.

 #include "Database.prg" // Contains generic database functions

– Call hbmk2:

 C:\hmg\harbour\bin hbmk2 typical -run

 Note: While working / playing on programs, you may encounter some error messages like:

  Error F0029  Can't open #include file xxx
  Error E0002  Redefinition of procedure or function xxx
  Error: Referenced, missing, but unknown function(s): xxx
  undefined reference to HB_FUN_xxx

 Please don’t panic !

    “Error” is salt and pepper of programming play ! 😉

 The worst situation isn’t getting error, but is unable to stay !

   The “HB_FUN_xxx” may be seen weird at first meet. The “HB_FUN_” is a prefix given by system ( compiler ) to your function; so you need search erroneous point into tour program files without this prefix.

Now, let’s continue to our “typical” program:

If you compile the program with commented out #include … line, possibly it will work, by opening main menu:


But what’s that?

When selected a menu item (except “Quit”) we can’t see other than an empty screen!

Again, don’t panic!

This situation too is not very rare !

If you use vertical scroll bar of command / console window, you will notice that your screen is considerably much longer than seen !

To avoid this conflict, ( as stated above ) we need use a SetMode() function call at top of our Main() procedure ( but AFTER LOCAL statement ! ) :

  SetMode( 24, 79 )

 And now everything is OK.


In fact, not really everything, we have a few “fine adjustment”.

Cut and paste the section after “// Database.prg” to a separate “Database.prg” file, un-comment the “#include …” line and then re-compile.

In this case we have a “multiple prg” project. As stated earlier, better way is using a .hbp file instead of “#include …” statements.

Now comment out ( or delete now ) the #include line.

Build a new text file with name “typical.hbp” and with this content :


And recall hbmk2 without any modification :

C:\hmg\harbour\bin hbmk2 typical -run

That’s all !

Congratulations !

Now you have a multiple-prg project  !

HbMk2 : Harbour Maker

Harbour Make (hbmk2) 3.2.0dev (Rev. 18805)
Copyright (c) 1999-2013, Viktor Szakáts


hbmk2 [options] [<script[s]>] <src[s][.prg|.c|.obj|.o|.rc|.res|.def|.po|.pot|.hbl|@.clp|.d|.ch]>

-o<outname> output file name
-l<libname> link with <libname> library. <libname> should be without
path, extension and ‘lib’ prefix (unless part of
libname). Do not add core Harbour libraries, they are
automatically added as needed.
-L<libpath> additional path to search for libraries
-i<p>|-incpath=<p> additional path to search for headers
-static|-shared link with static/shared libs
-mt|-st link with multi/single-thread Harbour VM
-gt<name> link with GT<name> GT driver, can be repeated to link
with more GTs. First one will be the default at runtime
-inc[-] enable/disable incremental build mode (default: disabled)
-hbexe create executable (default)
-hblib create static library
-hbdyn create dynamic library (without linked Harbour VM)
-hbdynvm create dynamic library
-hbimplib create import library

-gui|-std create GUI/console executable
-main=<mainfunc> override the name of starting function/procedure
-request=<func> force function/procedure to be linked
-fullstatic link with all static libs
-pic[-] create position independent object code (always enabled
in -hbdyn/-hbdynvm modes)
-[full|fix]shared create shared Harbour binaries without/with absolute dir
reference to Harbour library (default: ‘fullshared’ when
Harbour is installed on system location, ‘fixshared’
otherwise) (fix/full option in *nix only)
-nulrdd[-] link with nulrdd
-debug[-] add/exclude C compiler debug info. For Harbour level
debug, use Harbour option -b as usual
-optim[-] toggle C compiler optimizations (default: on)
-cpp[-] force C/C++ mode
-cpp=<value> select C++ mode. Allowed values are: def, yes, no
-map[-] create (or not) a map file
-implib[-] create (or not) an import library (in -hbdyn/-hbexe
mode). The name will have a postfix added.
-implib=<output> create import library (in -hbdyn/-hbexe mode) name to
<output> (default: same as output)
-ln=<link> create symbolic link pointing to <output> (<link> is
considered relative to <output>)
-strip[-] strip (no strip) binaries
-trace[-] show commands executed
-beep[-] enable (or disable) single beep on successful exit,
double beep on failure
-ignore[-] ignore errors when running compiler tools (default: off)
-hbcppmm[-] override standard C++ memory management functions with
Harbour ones
-winuni[-] select between UNICODE (WIDE) and ANSI compilation modes
(default: ANSI) (Windows only. For WinCE it is always set
-nohblib[-] do not use static core Harbour libraries when linking
-nodefgt[-] do not link default GTs (effective in -static mode)
-nolibgrouping[-] disable library grouping on gcc based compilers
-nomiscsyslib[-] do not add extra list of system libraries to default
library list
-traceonly show commands to be executed, but do not execute them
-warn=<lev> set C compiler warning level
<lev> can be: max, yes, low, no, def (default: yes)
-compr=<lev> compress executable/dynamic lib (needs UPX)
<lev> can be: yes, no, min, max
-run[-] run/do not run output executable
-vcshead=<file> generate .ch header file with local repository
information. SVN, CVS, Git, Mercurial, Bazaar, Fossil and
Monotone are currently supported. Generated header will
define macro _HBMK_VCS_TYPE_ with the name of detected
VCS and _HBMK_VCS_ID_ with the unique ID of local
-tshead=<file> generate .ch header file with timestamp information.
Generated header will define macros _HBMK_BUILD_DATE_,
date/time of build
-icon=<file> set <file> as application icon. <file> should be a
supported format on the target platform
-manifest=<file> embed manifest <file> in executable/dynamic lib (Windows
-sign=<key> sign executable with <key> (Windows and Darwin only)
-signpw=<pw> use <pw> as password when signing executable (Windows and
Darwin only)
-instfile=<g:file> add <file> in to the list of files to be copied to path
specified by -instpath option. <g> is an optional copy
group (case sensitive), it must be at least two
characters long. In case you don’t specify <file>, the
list of files in that group will be emptied.
-instpath=<g:path> copy target to <path>. if <path> is a directory, it
should end with path separatorm, in this case files
specified by -instfile option will also be copied. can be
specified multiple times. <g> is an optional copy group,
it must be at least two characters long. Build target
will be automatically copied to default (empty) copy
-instforce[-] copy target to install path even if it is up to date
-depimplib[-] enable (or disable) import library generation for import
library sources specified in -depimplibs= options
(default: yes)
-stop[=<text>] stop without doing anything and display <text> if
-echo=<text> echo text on screen
-pause force waiting for a key on exit in case of failure (with
alternate GTs only)
-info turn on informational messages
-quiet[-] suppress all screen messages

-bldf[-] inherit all/no (default) flags from Harbour build
-bldf=[p][c][l] inherit .prg/.c/linker flags (or none) from Harbour build
-F<framework> link with <framework> framework (Darwin only)
-cflag=<f> pass single flag to C compiler
-resflag=<f> pass single flag to resource compiler (Windows only)
-ldflag=<f> pass single flag to linker (executable)
-aflag=<f> pass single flag to linker (static library)
-dflag=<f> pass single flag to linker (dynamic library)
-iflag=<f> pass single flag to import library creation command
-prgflag=<f> pass single flag to Harbour compiler
-runflag=<f> pass single flag to output executable when -run option is
-cflag+=<f> pass single flag to C compiler overriding C compiler
flags added by hbmk2 itself. Use with caution.
-3rd=<f> options/flags reserved for 3rd party tools, always
ignored by hbmk2 itself
-env:<e>[<o>[<v>]] alter local environment. <e> is the name of the
environment variable to alter. <o> can be ‘=’ to
set/override, ‘-‘ to delete, ‘+’ to append to the end of
existing value, ‘#’ to insert to the beginning of
existing value. <v> is the value to set/append/insert.
-jobs=<n> start n compilation threads (multiprocess platforms only)
-head=<m> control source header parsing (in incremental build mode)
<m> can be: native (uses compiler to extract
dependencies), full (default, uses simple text parser on
the whole file), dep, off
-rebuild rebuild (in incremental build mode)
-rebuildall rebuild with sub-projects (in incremental build mode)
-clean clean (in incremental build mode)
-workdir=<dir> working directory
(default: .hbmk/plat/comp in incremental mode, OS temp
directory otherwise)

-hbl[=<output>] output .hbl filename. %{hb_lng} macro is accepted in
-lng=<languages> list of languages to be replaced in %{hb_lng} macros in
.pot/.po filenames and output .hbl/.po filenames. Comma
separared list:
-po=<output> create/update .po file from source. Merge it with
previous .po file of the same name
-minipo[-] do (not) add Harbour version number and source file
reference to .po (default: add them)
-rebuildpo recreate .po file, thus removing all obsolete entries in

-hbx=[<.ch>] Create Harbour header (in .hbx format) with all external
symbols. Empty parameter will disable it.
-autohbc=<.ch:.hbc> <.ch> is a header file name. <.hbc> is a .hbc filename to
be automatically included in case the header is found in
any of the compiled sources. (EXPERIMENTAL)

-deppkgname=<d:n> <d> is the name of the dependency. <n> name of the
package depedency. Can be specified multiple times.
-depkeyhead=<d:h> <d> is the name of the dependency. <h> is the key header
(.h) of the package dependency. Multiple alternative
headers can be specified.
-depoptional=<d:f> <d> is the name of the dependency. <f> can be ‘yes’ or
‘no’, specifies whether the dependency is optional.
Default: no
-depcontrol=<d:v> <d> is the name of the dependency. <v> is a value that
controls how detection is done. Accepted values: no, yes,
force, nolocal, local. Default: content of envvar
-depincroot=<d:r> <d> is the name of the dependency. Set <r> as root
directory for paths specified in -depincpath options.
-depincpath=<d:i> <d> is the name of the dependency. Add <i> to the header
detection path list.
-depincpathlocal= <d> is the name of the dependency. Add <i> to the header
<d:i> detection path list, where <i> is pointing to a directory
local to the project and containing an embedded (or
locally hosted) dependency.
-depimplibs=<d:dll> <d> is the name of the dependency. Add <dll> to the
import library source list.
-depimplibd=<d:lib> <d> is the name of the dependency. Set generated import
library name to <lib>

-plugin=<filename> add plugin. <filename> can be: .hb, .prg, .hrb
-pi=<filename> pass input file to plugins
-pflag=<f> pass single flag to plugins

Options below are available on command line only:

-target=<script> specify a new build target. <script> can be .prg (or no
extension) or .hbp file. Note that .hbp files are
automatically considered as separate targets.

-hbrun run target
-hbraw stop after running Harbour compiler
-hbcmp|-clipper stop after creating the object files
create link/copy hbmk2 to hbcmp/clipper for the same
-hbcc accept raw C flags
create link/copy hbmk2 to hbcc for the same effect
-hblnk accept raw linker flags
-autohbm[-] enable (or disable) processing of hbmk.hbm in current
directory (default: yes)
-hb10 enable Harbour 1.0.x compatibility mode
-hb20 enable Harbour 2.0.x compatibility mode
-xhb enable xhb mode
-hbc enable pure C mode
-exospace emulate Clipper compatible linker behavior
create link/copy hbmk2 to rtlink/blinker/exospace for the
same effect

-hbreg[=global] register Harbour Script (.hb) with hbmk2 (Windows only)
-hbunreg[=global] unregister Harbour Script (.hb) from hbmk2 (Windows only)

-hbmake=<file> convert hbmake project <file> to .hbp file
-xbp=<file> convert .xbp (xbuild) project <file> to .hbp file
-xhp=<file> convert .xhp (xMate) project <file> to .hbp file

–hbdirbin output Harbour binary directory
–hbdirdyn output Harbour dynamic library directory
–hbdirlib output Harbour static library directory
–hbdirinc output Harbour header directory
–hbinfo[=nested] output Harbour build information. Output is in JSON
format. The included paths always contain forward
slashes. Each JSON block is followed by an 0x0A byte.

-plat=<platform> force/select target platform (default: autodetection)
-comp=<compiler> force/select C compiler (default: autodetection)
Special value:
– bld: use original build settings (default on *nix)
-cpu=<cpu> select target CPU. (EXPERIMENTAL)
-build=<name> use a specific build name
-lang=<lang> override default language. Similar to HB_LANG envvar.
-width=<n> set output width to <n> characters (0=unlimited).
-shl show sub-project level in output lines
–version display version header only

– <script> can be:
<@script> or <script.hbm>: command line options in file
<script.hbp>: command line options in file, it also marks a new target if
specified on the command line
<script.hbc>: package configuration file
– Multiple -l, -L, -i and <script> parameters are accepted.
– Regular Harbour compiler options are also accepted.
(see them with -harbourhelp option)
– hbmk.hbc option file in hbmk2 directory is always processed if it exists.
On *nix platforms ~/.harbour, /etc/harbour, <base>/etc/harbour, <base>/etc
are checked (in that order) before the hbmk2 directory.
– hbmk.hbm make script in current directory is always processed if it exists.
– .hbc options (they should come in separate lines): libs=[<libname[s]>],
hbcs=[<.hbc file[s]>], gt=[gtname], syslibs=[<libname[s]>],
frameworks=[<framework[s]>], prgflags=[Harbour flags], cflags=[C compiler
flags], resflags=[resource compiler flags], ldflags=[linker flags],
pflags=[flags for plugins], libpaths=[paths], sources=

headers=[Harbour header files], psources=

incpaths=[paths], requests=[func], instfiles=[files], instpaths=[paths],
autohbcs=[<.ch>:<.hbc>], plugins=[plugins],
run|inc=[yes|no], cpp=[yes|no|def], warn=[max|yes|low|no|def],
compr=[yes|no|min|max], head=[off|full|native|dep], skip=<reason>,
stop=<reason>, echo=<text>
Lines starting with ‘#’ char are ignored
– Platform filters are accepted in each .hbc line and with several options.
Filter format: {[!][<plat>|<comp>|<cpu>|<keyword>]}. Filters can be
combined using ‘&’, ‘|’ operators and grouped by parentheses. Ex.: {win},
{gcc}, {linux|darwin}, {win&!pocc}, {(win|linux)&!watcom}, {unix&mt&gui},
-cflag={win}-DMYDEF, -stop{dos}, -stop{!allwin},
– Certain .hbc lines (libs=, hbcs=, prgflags=, cflags=, ldflags=, libpaths=,
instfiles=, instpaths=, echo=) and corresponding command line parameters
will accept macros: ${hb_root}, ${hb_dir}, ${hb_dirname}, ${hb_name},
${hb_self}, ${hb_curdir}, ${hb_tempdir}, ${hb_targetname},
${hb_targettype}, ${hb_plat}, ${hb_comp}, ${hb_comp_ver}, ${hb_build},
${hb_cpu}, ${hb_work}, ${hb_workdynsub}, ${hb_dynprefix}, ${hb_dynsuffix},
${hb_dynext}, ${hb_ver}, ${hb_verstr}, ${hb_major}, ${hb_minor},
${hb_release}, ${hb_status}, ${hb_revision}, ${hb_host_plat},
${hb_host_plat_unix}, ${hb_bin}, ${hb_lib}, ${hb_lib3rd}, ${hb_dyn},
${hb_inc}, ${hb_first}, ${hb_outputdir}, ${hb_outputname}, ${hb_level},
${<envvar>}. libpaths= also accepts %{hb_name} which translates to the name
of the .hbc file under search.
– Options accepting macros also support command substitution. Enclose command
inside “, and, if the command contains space, also enclose in double
quotes. F.e. “-cflag=`wx-config –cflags`”, or
ldflags={unix&gcc}”`wx-config –libs`”.
– Libraries and object files built with/for CA-Cl*pper won’t work with any
supported platform/compiler.
– Defaults and feature support may vary by platform/compiler.
– Options can also be specified in environment variable HBMK_OPTIONS
– .hb or .hrb file passed as first parameter will be run as Harbour script.
Note, for Harbour scripts, the codepage is set to UTF-8 by default.
– . (dot) passed as first parameter will enter the interactive Harbour shell.

Supported <comp> values for each supported <plat> value:
– linux : gcc, clang, icc, watcom, sunpro, open64
– darwin : gcc, clang, icc
– win : mingw, msvc, clang, bcc, bcc64, watcom, icc, pocc, xcc,
mingw64, msvc64, msvcia64, iccia64, pocc64
– wce : mingwarm, mingw, msvcarm, poccarm
– os2 : gcc, gccomf, watcom
– dos : djgpp, watcom
– bsd : gcc, clang, pcc
– hpux : gcc
– beos : gcc
– qnx : gcc
– android : gcc, gccarm
– vxworks : gcc, diab
– symbian : gcc
– cygwin : gcc
– minix : gcc, clang, ack
– aix : gcc
– sunos : gcc, sunpro

For further info :




Harbour Utilities / Tools

Harbour :

Harbour.exe : Harbour compiler

HbFormat : Formats the source code according to certain criteria

HbIDE  : Visual Development environment for the Harbour and other xBase dialects

Hbi18n : A tool that makes finding applications for other languages

HbMk2    : Ultimate project maker for Harbour applications

HbNetIO  : Harbour NETIO Server

HbPP   : Harbour preprocessor

HbRun  : Console interpreter and .prg/.hrb runner for the Harbour Language

HbTest   : Harbour Regression Test Suite

3rth Party:

rcc.exe  : Qt resource compiler

uic.exe  : Qt User Interface Compiler

upx.exe  : Ultimate Packer for eXecutables

windres  : Resource compiler

Enter  windres3011 –help for options.