I can answer the first one. Use windows API functions.
#include .\..\include\vfx.h
#define APP_NOT_RUNNING 0
#define WND_RESTORE 1
#define WND_MINIMIZED 2
#define WND_MAXIMIZED 3
local ;
llAPIError, ;
lnAppHndl
DECLARE INTEGER BringWindowToTop IN WIN32API INTEGER hWnd
DECLARE INTEGER FindWindow IN WIN32API STRING cNull, STRING cWinName
DECLARE INTEGER ShowWindow IN WIN32API INTEGER hWnd, INTEGER nState
* Only allow one instance of this app to run.
if FindWindow( 0, MAINTITLE_LOC ) = APP_NOT_RUNNING
do form frmInput
endif
* When the form is running, the on error is set to thisform.error.
* If an error occurs in the code below, the VFP error handler
* will kick in, since this prg is not called by the form.
lcOldOnError = on( 'error' )
llAPIError = .F.
on error llAPIError = .T.
lnAppHndl = FindWindow( 0, MAINTITLE_LOC )
if lnAppHndl = APP_NOT_RUNNING
llAPIError = .T.
else
BringWindowToTop( lnAppHndl )
ShowWindow( lnAppHndl, WND_RESTORE )
endif
if llAPIError
messagebox( "Could not start lookup program--cancelling.",;
MB_OK + MB_ICONSTOP, CAP_APPLICATION_TITLE )
return .F.
endif
on error &lcOldOnError
read events
#undefine WND_RESTORE
#undefine WND_MINIMIZED
#undefine WND_MAXIMIZED
#undefine APP_NOT_RUNNING
>I have two subjects on applications developed in VFP:
>-how could I do to impede that an user opens an application twice or more?
>-case a file.DBF comes to be corrupted (.DBF version 5.0 of VFP) some exists tool
>what can I use to correct its structure?
>
>Could they help me? Thank you.
----------
Mark Bucciarelli