Building Harbour, HMG, Projects
How I can build Harbour and / or HMG ?
How I can build a Harbour applications ?
How I can build a HMG applications ?
How to build menu like old ACHOICE function?
KPI (Key Performance Indicator) Dashboard
In post-DOS Oss it’s possible running multiple applications, even multiple instance of same application simultaneously. Sometime running multiple instance of same application may cause unpredictable results. So requires impeding, For this purpose HMG offers SET MULTIPLE ON | OFF [WARNING] command which impedes (OFF) or allow (ON) attempts to run multiple instances of the application with optional warning for both situation.
Sometime may be requires decide to allowing at run time. In this case you need know either a running instance exist or not before allowing or impeding.
IsAppRunning() function is for help this situation.
#include <hmg.ch> PROCEDURE Main() LOCAL cCurrApp := HB_ProgName() IF IsAppRunning( cCurrApp ) MsgSTop( cCurrApp + CRLF + CRLF +; "Application is running already !", "Error") ELSE DEFINE WINDOW frmIsAppRunTest ; ROW 0 ; COL 0 ; WIDTH 650 ; HEIGHT 450 ; TITLE "Testing 'IsAppRunning()' function" ; ON INIT MsgInfo( cCurrApp + CRLF + CRLF + ; "Application is running for first time !",; "No problem") ; MAIN ON KEY ESCAPE ACTION ThisWindow.Release END WINDOW // frmIsAppRunTest frmIsAppRunTest.Center() frmIsAppRunTest.Activate() ENDIF RETURN // IsAppRunTest.Main() *-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._. PROCEDURE IsAppRunning(; cAppName ) LOCAL aProcess := EnumProcessesID(),; // --> return array { nProcessID1, nProcessID2, ... } nInstance := 0,; n1ProcID,; lRVal := .F. FOR EACH n1ProcID IN aProcess IF cAppName == GetProcessFullName( n1ProcID ) IF ++nInstance > 1 lRVal := .T. EXIT ENDIF ENDIF NEXT n1ProcID RETURN lRVal // IsAppRunning() *-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.
Q: What are relations and differences between this 3 services you’ve been provided: Harbour Compiler, Harbour HMG, HMG-IDE. We need to know exactly when and why use them?
Harbour : Is a multi-platform open source compiler for xBase programming language, as a continuation of Clipper Programming Language. You can use Harbour with or without HMG; as pure console mode or with another GUI facility.
HMG / MiniGUI : is also an open source GUI Library developed by Roberto Lopez, for Harbour Compiler, designed exclusively Windows platform only. You can’t use HMG without Harbour.
HMG-IDE is a free utility developed by Roberto Lopez, builder of HMG. An Integrated Development Environment including a project builder and a form designer; plus a DB Manager. You can use HMG library with or without HMG-IDE.
As you easily see and cited here with this three products we have a comprehensive and complete Windows programming toolkit or Clipper for Windows ➡
By Sri Rathinagiri » Mon Sep 08, 2014 12:44 pm
Clipper programmers sometimes find it difficult to accommodate with HMG. The reason is the difference between TUI (Text User Interface) and GUI. In GUI, the program control is in the hands of the user and it is event driven. User can click on anything (say minimize button, maximize button, even another program running behind or any controls). So, it is our duty to design the whole window and wait for user’s action and write procedures for each and every action of the user.
GUI offers many innovative controls like Grid, Combobox, Button, Spinner etc., as against only textbox in TUI. So, we have to eventually accommodate events for all these controls.
Now, coming to HMG as not only a GUI library but a bundle of all. Even though HMG is directly based on the latest Harbour versions, HMG comes as a bundle. You need not install any other software to build a windows application. Full stop. 🙂 It contains the GUI library, PRG compiler, C Compiler and all the supporting software products to successfully build an application.
People (at least me) sometimes misunderstand GUI and OOP as one and the same. GUI and OOP are different and independent to each other. GUI can be made to work with or without OOP and vice versa. HMG is based on Win32 API system. Win32 API system works on handles and hooks. Every window/control in HMG is provided with a handle (like the file handle in clipper) and events are hooked on that particular handle. Once any hooked event is fired by the user (say a click of a button) immediately Win32 API searches for a CallBack function which is provided by the developer via HMG. The beauty of HMG would be, the developer is made free from handling all these internal affairs, handles, hooks and callback procedures. Instead he can concentrate on what is to be done if the event is fired.
You will be astonished to see how a ‘define window’ statement in HMG invokes 100s of lines of Harbour and C code. Please see the source folder of HMG if you want to know in detail.
Again, the advantage of HMG is, you need not include any dlls with your executable code as it is based on Win32 API. The application would run in XP to Windows version 8 (even in Windows 97 some cases).
Now coming to your questions.
To answer this questions, pls help us by showing links which permit us to download. And by sharing your source-code available for public.
Screenshoot attached herein, is a sample screen handle we need to implement on our application, ASAP. Being programmers for long time, we need any advanced skill in order to satisfy our users/clients currently still using our DOS-apps-versions.
You can start with Your HMG Directory\SAMPLES\Basics\TUTORIAL folder. It contains various tutorials for basic programmers. Then you can see basic and controls sub-folders of samples. I don’t think that any advanced skill set is required to satisfy our existing DOS clients. Actually ther will be happy to update their programs to Windows version as it is user friendly and more flexible.
This problem never arise under DOS who own a single window. I noticed when exercising HMG-ID (executing IDE.EXE) to build project, the RUN (F5) function fails to detect the problem. that’s way HMG-IDE made run-time error as if the mistake came from source program.
Yes, it is a valid point. In HMG-IDE previous version there was an error marking ‘Is the program still running?’. I don’t know what happened to that in the recent versions. I will request Claudio to look into this. Thanks for reporting.
The project says the latest stable version is 3.0.0. while this forum says HMG 3.3.1. Any clarification in this matter is urgently needed to avoid confusion.
Because they are entirely different projects. As I have discussed earlier, HMG is based on Harbour. But it is a bundle by itself. Some major implementations have been made after the versions HMG 3.0. Introducing Unicode in 3.1. Made it to a stable version in 3.2. And the latest and significant achievement is HMG in 64 Bits, which made it to 3.3 series.
HMG Extended is also developed and released parallelly and they have their own version numbering system.
IMHO, we can use the latest stable versions for the development.
Harbour compiler is the core. Habour MiniGUI is the Win32 wrapper library to access the GUI aspects of the programs. HMG IDE is a tool to develop and build our software in Harbour MiniGUI.
You can use simply Harbour if you need only console mode. If you want GUI support, you can use Harbour MiniGUI and its build.bat ( even without using HMG IDE at all).
If you need Forms Designer and an easy build system, you can use HMG IDE which can co-ordinate your forms, database, resources (icons, pictures etc) and linking other third party libraries.
Sri Rathinagiri
Sivakasi, India
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Courtesy of author, this article borrowed from here.
File Name: HMG.3.0.46.exe
File Size: 38.91 MB
Date: 06. November 2012
– Update to latest Harbour Nightly Build (18443 2012-11-05)
– New
– Print Barcode sample. See samples/printean13 folder for details. (Contributed by Marek Olszewski)
– Desktop Make Shortcut for file/dir and URLs in HFCL. See sample at hfcl/samples/makeshortcut folder. (Contributed by B.P Dave and Esgici)
– buildalllib.bat in the base directory to build all the libraries including hmg, hfcl, hmgsqlbridges, crypt, edit, editex, ini, graph, report etc with a single call.
– Included hbvpdf library in HMG library folder. This library is required to compile all the samples in samples/report.advanced folders.
– Update
– Bos Taurus Graphics library 1.01. Author Claudio Soto had modified the source files to make it compatible for HFCL. (Thanks to Claudio Soto)
– Updated BT_BitmapLoadFile() fuction, now load images in the formats: BMP, GIF, JPG, TIF and PNG.
– Added Functions:
– BT_BitmapInvert
– BT_BitmapContrast
– BT_BitmapModifyColor
– BT_BitmapGammaCorrect
– BT_BitmapConvolutionFilter3x3
– Updated BosTaurus-FunctionsReferenceGuide.PDF with changes made.
– Added Demo10
– HMG_HPDF Library in HFCL. Now the image command accepts both jpg and png file formats from either file or resource location. (Contributed by Claudio Soto)
– Fix
– Number of warnings while compiling the HMG library is now reduced to only six. Great thanks to Claudio Soto.
– Hardcoded Path name references in batch files. Now HMG can be installed any path (having no spaces).
( In order of publishing date )
Roberto Lopez (Builder of HMG and HMG-IDE; Buenos Aires, Argentina )
Sri Rathinagiri (Builder and Administrator of HMG Forum; Sivakasi, India)
How I have joined HMG Family – A Story
An explanation about Harbour, HMG and HMG-IDE
Raumi ( Senior member of HMG-Forum; Lünen, Germany )
From CA-Clipper to Windows in 5 Minutes
Postgresql as a backend for HMG
Danny Del Pilar ( Senior member of HMG-Forum; Manila, Philippines )
Agil Abdullah Batati (Programmer Never Surrender; Jakarta / Indonesia )
The Easy Way To Study Programming In Harbour And HMG — Part I
Beware : This article posted on February 2, 2013 and than with HMG 3.1.3 release on 23 May 2013 added 5th and 6th parameters to that function by our genius Dr. Soto …
Look at changelog of HMG.
PutFile() is a HMG function that :
Opens ‘Save As’ System Dialog And Returns The Saved File name
Syntax:
PutFile ( acFilter , cTitle , cIniFolder , lNoChangeDir ) –> cSavedFileName
Although its name is “Put”, this function doesn’t “put” anything to anywhere; that is don’t write anything to disk. It only return a file name ( or empty string if user not selected / typed anything). File that name returned by PutFile() may exist or not. This is only difference between PutFile() and GetFile(); the second return only name of an existing file.
Therefore PutFile() function doesn’t check overwrite status. This is totally responsibility of programmer and if not care, PutFile() become a dangerous tool. The “Default File Name” and network environments will increase the risk. Of course no problem for intentionally overwrite.
As a result, PutFile() open a “Save As…” dialog box and returns a file name to save, selected / typed by user.
As above syntax indicated, this function has four parameters.
Whereas sometime required a bit more info : default file name.
When program suggest a default file name, in addition to select / type a new file name, user may feel more comfortable by only confirm (verbatim or after typing something) suggested file name.
This is a bit modified version of PutFile() (with a small test program); since accept default file name as 5th parameter, name is PutFile5P()
Note : This work is superseded by adding two parameters to official PutFile() function at HMG 3.1.4 2013/06/16.
Happy HMG’ing 😀
~~~~~~~~~~~~~~~~
/* HMG Common Dialog Functions PutFile5P() Test prg. */ #include "hmg.ch" PROCEDURE Main() LOCAL nTask DEFINE WINDOW Win_1 ; AT 0,0 ; WIDTH 400 ; HEIGHT 400 ; TITLE 'PutFile with Default File Name' ; MAIN DEFINE MAIN MENU POPUP 'Common &Dialog Functions' ITEM 'PutFile5P()'ACTION MsgInfo( Putfile5P( ; { {'Text Files','*.txt'} },; // 1° acFilter ; 'Save Text',; // 2° cTitle 'C:\',; // 3° cIniFolder ,; // 4° lNoChangeDir "New_Text.TXT" ) ) // 5° cDefaultFileName END POPUP END MENU END WINDOW ACTIVATE WINDOW Win_1 RETURN // TestPF5P.PRG ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *-----------------------------------------------------------------------------* FUNCTION Putfile5P ( aFilter, title, cIniFolder, nochangedir, cDeFilName ) *-----------------------------------------------------------------------------* LOCAL c:='' , n IF aFilter == Nil aFilter := {} EndIf IF HB_ISNIL( cDeFilName ) cDeFilName := '' ENDIF FOR n := 1 TO Len ( aFilter ) c += aFilter [n] [1] + chr(0) + aFilter [n] [2] + chr(0) NEXT RETURN C_PutFile5P ( c, title, cIniFolder, nochangedir, cDeFilName ) *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #pragma BEGINDUMP #define HB_OS_WIN_USED #define _WIN32_WINNT 0x0400 #include <windows.h> #include "hbapi.h" #include "hbapiitm.h" HB_FUNC ( C_PUTFILE5P ) { OPENFILENAME ofn; char buffer[512]; int flags = OFN_FILEMUSTEXIST | OFN_EXPLORER ; if ( hb_parl(4) ) { flags = flags | OFN_NOCHANGEDIR ; } if( strlen( hb_parc( 5 ) ) != 0 ) strcpy( buffer, hb_parc( 5 ) ); else strcpy( buffer, "" ); memset( (void*) &ofn, 0, sizeof( OPENFILENAME ) ); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = GetActiveWindow() ; ofn.lpstrFilter = hb_parc(1) ; ofn.lpstrFile = buffer; ofn.nMaxFile = 512; ofn.lpstrInitialDir = hb_parc(3); ofn.lpstrTitle = hb_parc(2) ; ofn.Flags = flags; if( GetSaveFileName( &ofn ) ) { hb_retc( ofn.lpstrFile ); } else { hb_retc( "" ); } } #pragma ENDDUMP