Re: don´t run App twice
Posted: Thu May 28, 2020 2:28 pm
Perfect!
Exclusive forum for HMG, a Free / Open Source xBase WIN32/64 Bits / GUI Development System
http://hmgforum.com/
Code: Select all
iif(IsMinimized (hWnd), Restore( hWnd ), SetForegroundWindow( hWnd ))
Code: Select all
@ User32:SetForegroundWindow( hWndDlg )
@ User32:BringWindowToTop( hWndDlg )
@ User32:ShowWindow( hWndDlg, 1 )
@ User32:UpdateWindow( hWndDlg )
Code: Select all
INIT PROCEDURE // Declare an initialization procedure
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
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