best way to check function and program called

best way to check function and program called

Postby damianodec » Sat Mar 18, 2017 2:20 pm

hi to all
I have my MYPROG.EXE, in this program I have this choiche on menu...
Code: Select all  Expand view

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 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 414
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: best way to check function and program called

Postby Enrico Maria Giordano » Sat Mar 18, 2017 2: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: Select all  Expand view
IF ISEXERUNNING( CFILENOEXT( HB_ARGV( 0 ) ) )
    // EXE already executing
    RETURN NIL
ENDIF


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8243
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: best way to check function and program called

Postby damianodec » Sat Mar 18, 2017 2: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 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 414
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: best way to check function and program called

Postby Enrico Maria Giordano » Sat Mar 18, 2017 2:44 pm

No, sorry. But you can do something like this:

Code: Select all  Expand view
lFlag = .T.

DEFINE DIALOG oDlg...

...

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


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8243
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 15 guests