FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour best way to check function and program called
Posts: 434
Joined: Wed Jun 06, 2007 02:58 PM
best way to check function and program called
Posted: Sat Mar 18, 2017 02:20 PM
hi to all
I have my MYPROG.EXE, in this program I have this choiche on menu...
Code (fw): Select all Collapse
function BuildMenu()
   local oMenu
    MENU oMenu
        MENUITEM "Ricerca"
        MENU
            MENUITEM "Trova articoli" ACTION ricerc() ;
                MESSAGE "trova articoli"
            MENUITEM "Articoli in ordine" ACTION ordini() ;
                MESSAGE "Articoli in ordine"

Action Ricerc() start and open one nowait dialog.
1. How can I to check if ricerc() is already active ?
2. How can I stopped If users run another time MYPROG.EXE?

ciao
Damiano
FiveWin for xHarbour 24.02 - Feb. 2024 - Embarcadero C++ 7.60 for Win32 Copyright (c) 1993-2023

FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)

Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: best way to check function and program called
Posted: Sat Mar 18, 2017 02:27 PM
damianodec wrote:1. How can I to check if ricerc() is already active ?


You can use a flag. Set it to .T. just before the DEFINE DIALOG and to .F. in the dialog's VALID clause.

damianodec wrote:2. How can I stopped If users run another time MYPROG.EXE?


Use something like this:

Code (fw): Select all Collapse
IF ISEXERUNNING( CFILENOEXT( HB_ARGV( 0 ) ) )
    // EXE already executing
    RETURN NIL
ENDIF


EMG
Posts: 434
Joined: Wed Jun 06, 2007 02:58 PM
Re: best way to check function and program called
Posted: Sat Mar 18, 2017 02:30 PM
hi Enrico, thank you for reply
You can use a flag. Set it to .T. just before the DEFINE DIALOG and to .F. in the dialog's VALID clause.

can you show me any example?

thank you
FiveWin for xHarbour 24.02 - Feb. 2024 - Embarcadero C++ 7.60 for Win32 Copyright (c) 1993-2023

FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)

Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: best way to check function and program called
Posted: Sat Mar 18, 2017 02:44 PM
No, sorry. But you can do something like this:

Code (fw): Select all Collapse
lFlag = .T.

DEFINE DIALOG oDlg...

...

ACTIVATE DIALOG oDlg;
    VALID lFlag := .F.;
    NOMODAL


EMG

Continue the discussion