don´t run App twice
Moderator: Rathinagiri
- dragancesu
- Posts: 921
- Joined: Mon Jun 24, 2013 11:53 am
- DBs Used: DBF, MySQL, Oracle
- Location: Subotica, Serbia
Re: don´t run App twice
see in help
SET MULTIPLE ON | OFF [ WARNING ]
SET MULTIPLE ON | OFF [ WARNING ]
- AUGE_OHR
- Posts: 2062
- Joined: Sun Aug 25, 2019 3:12 pm
- DBs Used: DBF, PostgreSQL, MySQL, SQLite
- Location: Hamburg, Germany
Re: don´t run App twice
hi,
does work ... but i want "more"
when App is already working but e.g. in Tasklist i want to "SetForegroundWindow()"
---
use Xbase++ it does start :
so how do it under harbour / HMG
Code: Select all
SET MULTIPLE OFF
when App is already working but e.g. in Tasklist i want to "SetForegroundWindow()"
---
use Xbase++ it does start :
before Main so i have this in AppSysERRORSYS
DBESYS // RDD
APPSYS
Code: Select all
PROCEDURE AppSys()
LOCAL cTitle := "XCM " + VERSION()
LOCAL hWndDlg := @User32:FindWindowA( 0, cTitle )
IF !( hWndDlg == 0 )
@ User32:SetForegroundWindow( hWndDlg )
@ User32:BringWindowToTop( hWndDlg )
@ User32:ShowWindow( hWndDlg, 1 )
@ User32:UpdateWindow( hWndDlg )
// ** It is a second instance.... Bye-Bye
QUIT
ENDIF
RETURN
have fun
Jimmy
Jimmy
- serge_girard
- Posts: 3166
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: don´t run App twice
Woudl be nice to have!
Serge
Serge
There's nothing you can do that can't be done...
Re: don´t run App twice
Serge,
We have the following simple sample below:
Code: Select all
#include <minigui.ch>
Procedure MAIN
Local cTitle := 'One Instance Sample'
OnlyOneInstance( cTitle )
DEFINE WINDOW Main ;
WIDTH 600 ;
HEIGHT 400 ;
TITLE cTitle ;
MAIN
END WINDOW
Main.Center
Main.Activate
Return
Function OnlyOneInstance( cAppTitle )
Local hWnd := FindWindowEx( ,,, cAppTitle )
if hWnd # 0
iif( IsIconic( hWnd ), _Restore( hWnd ), SetForeGroundWindow( hWnd ) )
ExitProcess( 0 )
endif
Return NIL
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
- serge_girard
- Posts: 3166
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: don´t run App twice
Where is defined function IsIconic?
Is it present in HMG, too?
Is it present in HMG, too?
Re: don´t run App twice
Marek,
Sure.
Please add the following translate statement in your HMG code:
Code: Select all
#xtranslate IsIconic ( <hWnd> ) => IsMinimized ( <hWnd> )
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
- serge_girard
- Posts: 3166
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: don´t run App twice
Hi Grigory, WHat about _Restore in HMG?
Serge
Serge
There's nothing you can do that can't be done...
Re: don´t run App twice
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein