FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to activate minimized program?
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
How to activate minimized program?
Posted: Tue Aug 25, 2009 04:01 PM

Dear All,

I cannot find this topic, it might off topic.
I want to activate the minimized program from system tray. It means "Allow to run program once only".

Regards,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: How to activate minimized program?
Posted: Tue Aug 25, 2009 07:23 PM

Try oWnd:Normal().

EMG

Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: How to activate minimized program?
Posted: Wed Aug 26, 2009 04:09 AM

Dear EMG,

I'm sorry to explain unclearly. I need to activate the program when the user dblclick on shortcut if program has been minimized. It will protect the user open program more than one.

Regards,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 41
Joined: Thu Dec 22, 2005 07:39 AM
Re: How to activate minimized program?
Posted: Wed Aug 26, 2009 05:29 AM
Hello, Dutch!
In my programs I did it such way:
Code (fw): Select all Collapse
if IsExeRunning( 'dispan.exe' ).or.IsExeRunning( 'Dispan.exe' ).or.IsExeRunning( 'DISPAN.exe' ).or.IsExeRunning('DISPAN.EXE' )
   if pppp()==1
      msgstop('Program is already running.','Ups...')
   endif
   return .f.
endif

in the start of program. And this is function PPP:
Code (fw): Select all Collapse
#PRAGMA BEGINDUMP
#include "Windows.h"
#include "ClipApi.h"

HB_FUNC( PPPP )
{
HWND hWnd;  
if (hWnd=FindWindow(NULL,"Clinical examination""))
       {
        ShowWindow(hWnd,SW_RESTORE);
        SetForegroundWindow(hWnd);
        _retni(0);
       }
_retni(1);
}
#PRAGMA ENDDUMP

Where "Clinical examination" is the name of main window in program.
Best regards!

Sergey (Loach) Abelev

fwh 9.04/xHarbour 1.2.1 (Rev. 6406)/Bcc55
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Re: How to activate minimized program?
Posted: Wed Aug 26, 2009 05:48 AM
Hi Mr.Dutch,

Even the following code also works.

Code (fw): Select all Collapse
SetForeGroundWindow(oWnd)

***************************************************************************************************
*** SetForeGroundWindow( hWnd ) to Bring the Minimised window to ForeGround ***
***                             When the user try to execute it again                                ***
***************************************************************************************************

DLL32 FUNCTION SetForeGroundWindow( hWnd AS LONG ) AS BOOL;
PASCAL FROM "SetForegroundWindow" LIB "user32.dll"


- Ramesh Babu P
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How to activate minimized program?
Posted: Wed Aug 26, 2009 11:47 AM

Mr Dutch

The above suggestions are good.

You may also like to see "showapp.prg" in the samples folder of fwh.
This sample program answers your requirement exactly

Regards



G. N. Rao.

Hyderabad, India
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: How to activate minimized program?
Posted: Wed Aug 26, 2009 12:15 PM

Dear Rao and All,

Thanks, all solution is working great. ShowApp.prg is the one that I'm looking for.

Regards,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)

Continue the discussion