How to activate minimized program?

How to activate minimized program?

Postby dutch » Tue Aug 25, 2009 4: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 19.01 / 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)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Re: How to activate minimized program?

Postby dutch » Wed Aug 26, 2009 4: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 19.01 / 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)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to activate minimized program?

Postby Loach » Wed Aug 26, 2009 5:29 am

Hello, Dutch!
In my programs I did it such way:
Code: Select all  Expand view

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: Select all  Expand view
#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
Loach
 
Posts: 41
Joined: Thu Dec 22, 2005 7:39 am
Location: Gomel, Belarus

Re: How to activate minimized program?

Postby RAMESHBABU » Wed Aug 26, 2009 5:48 am

Hi Mr.Dutch,

Even the following code also works.

Code: Select all  Expand view


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
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Re: How to activate minimized program?

Postby nageswaragunupudi » 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
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to activate minimized program?

Postby dutch » 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 19.01 / 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)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 83 guests