Grigory Filatov

Contributed works of Grigory Filatov

Adaptation FiveWin TsBrowse class
Color Table
Center Window’s Title
Closes application when no activity
Copy Protection (Get BIOS Name)

GetFonts
Get list of all controls

GIF animation demo

Is application running ?

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()

*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.

What Is a Window ?

In computing, a window ( aka form ) is an enclosed, rectangular area on a display screen. Most modern operating systems and applications have graphical user interfaces ( GUIs ) that let divide display into several windows. Within each window, may run a different program or display different data.

Windows are particularly valuable in multitasking environments , which allow to execute several programs at once. By dividing display into windows, may seen the output from all the programs at the same time. To enter input into a program, you simply click on the desired window to make it the foreground process.

WhatIsAWindow

GUI enable to set the dimensions and position of each window by moving the mouse and clicking appropriate buttons. Windows can be arranged so that they do not overlap (tiled windows) or so they do overlap (overlaid windows). Overlaid windows (also called cascading windows) resemble a stack of pieces of paper lying on top of one another; only the topmost window is displayed in full. You can move a window to the top of the stack by positioning the pointer in the portion of the window that is visible and clicking the mouse buttons. This is known as popping. You can expand a window to fill the entire screen by selecting the window’s zoom box.

In addition to moving windows, changing their size, popping and zooming them, you can also replace an entire window with an icon (this is sometimes called minimizing). An icon is a small picture that represents the program running in the window. By converting a window into an icon, you can free up space on the display screen without erasing the window entirely. It is always possible to reconvert the icon into a window whenever you want.

How I can make an .exe ?

Making .exe (executable) means building application. So you may find answer of this question here.

Anyway I will work to re-describe the process by a simpler way:

Almost every HMG sample have two .bat file: build.bat and ide.bat and using these files are quite simple:

Open command / console window, go to directory ( by CD command) of the sample you want to compile, and enter a simple command :

build demo <- will build demo.exe from demo.prg
or
ide demo <- open HMG-IDE with demo.prg

( IDE will wait your “run” command by pressing “run” button.)

So you may use this two .bat files for your projects too.

Copy build.bat and / or ide.bat to your working <dir>, and modify them this way:

build.bat :

call c:\hmg\build.bat <myProject> | <myProgram>

ide.bat :

c:\hmg\ide\ide.exe <myProject> | <myProgram>

Note : in this syntax “|” means “or”; you don’t need enter both project and program file names nor this sign; simply enter either one or other.

Change:

– “c:\hmg\” depending on your environment (installation); such as c:\hmg.3.1.1\ or antything else;

– <myProject> | <myProgram> to your project / program file name.

Project file is a text file with “.hbp” extension and contains a list of name(s) of your program file(s).

After building such .hbp file, you may open it from directly HMG-IDE ( by “open project command) and again, you may build your .exe by  pressing “run” button.

Clipper and Networking

Clipper and Networking

HMG Samples

About HMG Samples

Language Related

 Arrays

Array Arithmetic

Load / Save ANY array

Conversion

DOS -> Windows Character Conversion

National Issues

National Alternate Collating Sequence

National Change Case

 Windows

Tracking Mouse

Controls

Browse

Quick Search    

Combo box

Dynamic ComboBox

Edit Box

Word wrap in EditBox

 Grid

Get Data Into Grid via IDE

Text Box

Auto fill in text box

Search in and Fill Box (SFilBox) 

Tree

Tree Menu

Two Methods for Tree

Functions

 Drives, Directories and Files

Drives and Directories

Directory List

Fill Directory List

PutFile() with default file name

Messages

HMG Message Functions

Message for multiple values

Message Extended

Where Is It ?

Improvements in Message functions

Miscellaneous

Is application running ?

Get Process ID

Simple Error Handling

Funny

Cuckoo Clock

Untouchable window

Warn Lazy User

Pegs Game

Drawing

Play Draw

Draw Border

Printing

 Text Mode

Using printer under Windows 

Obsolete ways

Send to File

Print File

GUI Mode

HMG Print

 HMG Print ( Mini Print ) for beginners in 10 easy steps

Print a plain text file by HMG Print – 1

HMG Report

HMG HPDF

HMG_HPDF — Bill

Unicode

HMG Unicode

Utilities

Color Codes

DB Validate 

Hex View

Mini Agenda

DBA : Data Base Assistant

Low-Level DBU

x-Base Modul List

Mini Search Machine (2014) 

Configuration Terms

Application :

A program designed to execute a set of interrelated tasks. Typically referring to a system designed to address a particular business purpose (e.g., Order Entry/Inventory/Invoicing, a document tracking database, or an insurance claims calculator).

Environment Variables :

Operating system variables that can be used to communicate configuration information to executable programs. Environment variables are manipulated using the DOS SET command. The Clipper language compiler and linker respond to certain environment variables. Clipper programs can inspect the settings of environment variables using the GETENV() function.

Executable File :

A file output from the linker directly executable from the operating system command line. Executable files have an .EXE extension.

See Also: Linker

Header File :

A source file containing manifest constant definitions; command or pseudofunctions; and/or program statements merged into another source file using the #include preprocessor directive.

See Also: Program File, Source Code, STD.CH

Library File :

A file containing one or more object modules. The linker searches specified libraries to resolve references to functions or procedures that were not defined in the object files being linked.

See Also: Linker, Module, Object File

Make File :

A text file used as input to a make utility containing the specifications and actions required to build a program or a system of programs. This file is often referred to as a description file.

See Also: Make

Object File :

A file that contains the output of a compiler or other language translator, generally the result of compiling a single source file. Object files are linked to create an executable program.

See Also: Linking, Program File

Procedure File :

An ASCII text file containing Clipper language procedure and function definitions usually ending with a (.prg) extension; a program file.

See Also: Program File

Program File :

An ASCII text file containing Clipper language source code. Program files usually end with a (.prg) extension. The compiler reads the program file, translates the source code, and produces an object file, that is then linked to produce an executable program.

See Also: Linking Object File Source Code

Script File :

A text file that contains command input to a compiler, linker, or other utility program. A script file is often used in lieu of equivalent keyboard input. For the Clipper compiler, script files contain a list of source files to be compiled into a single object file.

Source File :

A text file including source code.

See Also: Program File, Header File