How to activate minimized program?

Post Reply
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

How to activate minimized program?

Post by dutch »

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: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to activate minimized program?

Post by dutch »

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)
Loach
Posts: 41
Joined: Thu Dec 22, 2005 7:39 am
Location: Gomel, Belarus

Re: How to activate minimized program?

Post by Loach »

Hello, Dutch!
In my programs I did it such way:

Code: Select all

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

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

Re: How to activate minimized program?

Post by RAMESHBABU »

Hi Mr.Dutch,

Even the following code also works.

Code: Select all


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
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: How to activate minimized program?

Post by nageswaragunupudi »

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
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to activate minimized program?

Post by dutch »

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)
Post Reply