don´t run App twice
Moderator: Rathinagiri
- serge_girard
- Posts: 3161
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
- fouednoomen
- Posts: 186
- Joined: Sun Oct 14, 2012 8:33 am
- DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL, Oracle, ODBC
- Location: Tunisia
Re: don´t run App twice
where i should put this code
#xtranslate IsIconic ( <hWnd> ) => IsMinimized ( <hWnd> )
#xtranslate _Restore( <h> ) => Restore( <h> )
#xtranslate IsIconic ( <hWnd> ) => IsMinimized ( <hWnd> )
#xtranslate _Restore( <h> ) => Restore( <h> )
Re: don´t run App twice
Restore of minimazed application works fine.
But if I want to bring it to top - it is still under others
What is wrong?
But if I want to bring it to top - it is still under others
Code: Select all
iif(IsMinimized (hWnd), Restore( hWnd ), SetForegroundWindow( hWnd ))
- AUGE_OHR
- Posts: 2060
- Joined: Sun Aug 25, 2019 3:12 pm
- DBs Used: DBF, PostgreSQL, MySQL, SQLite
- Location: Hamburg, Germany
Re: don´t run App twice
hi,
as i wrote you need 4 Stepwhere @ User32 -> User32.DLL
but i don´t want to write it "in" Main, i want to start it "before" Main ...
what about
as i wrote you need 4 Step
Code: Select all
@ User32:SetForegroundWindow( hWndDlg )
@ User32:BringWindowToTop( hWndDlg )
@ User32:ShowWindow( hWndDlg, 1 )
@ User32:UpdateWindow( hWndDlg )
but i don´t want to write it "in" Main, i want to start it "before" Main ...
what about
Code: Select all
INIT PROCEDURE // Declare an initialization procedure
have fun
Jimmy
Jimmy
- AUGE_OHR
- Posts: 2060
- Joined: Sun Aug 25, 2019 3:12 pm
- DBs Used: DBF, PostgreSQL, MySQL, SQLite
- Location: Hamburg, Germany
Re: don´t run App twice
hi,
here HMG Version
here HMG Version
Code: Select all
STATIC cVersion := "v0.98"
INIT PROCEDURE MainInit()
LOCAL cTitle := 'HBFM ' + cVersion
LOCAL hWndDlg := FindWindowEx( ,,, cTitle)
IF !(hWndDlg == 0)
SetForegroundWindow(hWndDlg)
BringWindowToTop(hWndDlg)
ShowWindow(hWndDlg,1)
UpdateWindow(hWndDlg)
QUIT // It is a second instance. Bye Bye
ENDIF
RETURN
PROCEDURE MAIN
have fun
Jimmy
Jimmy
- fouednoomen
- Posts: 186
- Joined: Sun Oct 14, 2012 8:33 am
- DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL, Oracle, ODBC
- Location: Tunisia
Re: don´t run App twice
Please the complete code to use this alternative
Re: don´t run App twice
Complete code by adding Jimmy's code in
c:\MiniGUI\SAMPLES\BASIC\HELLO_WORLD\
Regards,
Anand
c:\MiniGUI\SAMPLES\BASIC\HELLO_WORLD\
Code: Select all
/*
* Harbour MiniGUI Hello World Demo
* (c) 2002-2009 Roberto Lopez
*/
#include "minigui.ch"
PROCEDURE Main
DEFINE WINDOW Win_1 ;
CLIENTAREA 400, 400 ;
TITLE 'Hello World!' ;
WINDOWTYPE MAIN
END WINDOW
Win_1.Center
Win_1.Activate
RETURN
INIT PROCEDURE MainInit()
LOCAL cTitle := 'Hello World!'
LOCAL hWndDlg := FindWindowEx( ,,, cTitle)
IF !(hWndDlg == 0)
SetForegroundWindow(hWndDlg)
BringWindowToTop(hWndDlg)
ShowWindow(hWndDlg,1)
UpdateWindow(hWndDlg)
QUIT // It is a second instance. Bye Bye
ENDIF
RETURN
Anand
- fouednoomen
- Posts: 186
- Joined: Sun Oct 14, 2012 8:33 am
- DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL, Oracle, ODBC
- Location: Tunisia
Re: don´t run App twice
Now it works fine! THX!