oracledba.help
QuickStarts

HMG

<- QuickStarts

Overview

With HMG (Harbour MiniGUI) you can develop full Windows applications in record time with unparalleled ease and power that has no run-time other than a single .exe file.

If you dont need huge run-time engines, hefty license fees and are not bound to the .Net and Java behemoths for desktop applications HMG might be for you.

HMG is Open Source. You'll want to contribute though after you start using it. This is a great community! To know what all this Harbour, xHarbour, Extended jargon is go here.

Essential Links

Procedure

  1. Download the latest HMG and run the setup.
    • Example file: HMG.3.4.2.Setup.exe
    • The installation creates the folder: C:\hmg.3.4.x
  2. Download the 64-bit Harbour and MinGW from here.
  3. Unzip .rar file in folder: c:\hmg.3.4.x
    It will create the following dirs:
    \HARBOUR-64
    \LIB-64
    \MinGW-64
    7zip can be used to unzip a .rar file.
  4. Build all the library files. C:\hmg.3.4.x\_BuildAllLib64.bat

Notes

  • To launch the HMG IDE run: C:\hmg.3.4.x\IDE\IDE.exe
    • Set to 64-bit via: Build -> 64-bits
    • Set the IDE to use your favorite editor via: Tools -> Preferences
  • To manually build 64-bit HMG apps use: C:\hmg.3.4.x\build64.bat
  • Example applications can be found in: C:\hmg.3.4.x\SAMPLES
  • Library routine examples (whats under the hood?): C:\hmg.3.4.x\SOURCE

Hello World

  1. Run the HMG IDE.
  2. With the IDE open the project file: C:\hmg.3.4.x\SAMPLES\Basics\Hello_World\hello.hbp
  3. Press the Run button.

Connect to Oracle

  1. Create a directory for your project: C:\app\hmg\dev\oratest1
  2. From the HMG IDE create a new project.
    • File -> New Project
    • File name: C:\app\hmg\dev\oratest1\oratest1
  3. Press Run and save the base file info for project when prompted.
  4. From the modules tab modify the main.prg as shown below then run the project.
#include <error.ch>
#include <hmg.ch>
#require "rddsql"
REQUEST SDDODBC, SQLMIX

Function Main
   LOCAL bError, hConn, cConnStr
   bError := ErrorBlock( {|e| Break(e)} )

   // Init DB (Change to suite your environment)
   Set( _SET_DATEFORMAT, "yyyy-mm-dd" )
   rddSetDefault("SQLMIX")
   cConnStr := "Driver={Oracle in OraDB12Home1};Server=SRV01/DB01;Uid=SCOTT;Pwd=Tiger"

   // Connect    
   hConn := rddInfo(1001, {"ODBC", cConnStr})
   IF hConn == 0
      MsgStop("Unable connect to server", rddInfo(RDDI_ERRORNO), rddInfo(RDDI_ERROR) )
      RETURN
   ELSE
      MsgInfo("Database Connection OK!","Status")
      dbCloseAll()  
   ENDIF

   /* -- Create Workarea and Get Data -- */
   BEGIN SEQUENCE
      // Get Workarea (AKA Cursor - AKA Recordset)    
      dbUseArea(.T., ,"SELECT sysdate FROM dual", "TEST")

      // Get Field Data      
      MsgInfo( "Date: " + DTOC(TEST->SYSDATE), "Field Data" )

      // Housekeeping
      dbCloseAll()        
   RECOVER
      MsgStop("Error Retrieving Data","Error")
   ENDSEQUENCE   

   // Init Windows Env
   Load Window Main
   Main.Center
   Main.Activate

   ErrorBlock(bError)
Return

There are many other ways to connect to data with HMG. Some include: (rdd, hbodbc, hbado, third party sqlrdd etc.).

A Brief History of HMG Time

Much longer versions of this can be found all over the Internet. Arguable the best programming\database language ever created was Clipper. Companies dont always market products equal to their potential so, though it was #1 in the industry, market forces forced it into the background. The programming dark age ensued...

The Clipper community could not be subdued however! The Internet and Open Source gave birth to Harbour! Then quickly xHabour and other forked variants. Finally Harbour MiniGUI (HMG) the most potent GUI API ever created set to the best programming language ever created.

Most every programming language after Clipper was influenced by it and owe it including: Visual Basic, Java, .Net and Python. Many find that once your start using the modern version Clipper (AKA xHarbour) there is no going back for you. Everything else will be too much effort and too many lines of code to get the same results.