FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Recall a HIDDEN window from taskmanager
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM

Recall a HIDDEN window from taskmanager

Posted: Tue Mar 28, 2017 08:12 PM

Hello,

I put a program into the taskmanager with the HIDDEN command :

ACTIVATE WINDOW oMain HIDDEN ON INIT ( OTimer:Activate() )

It checks for a file, and popup some information. This is working ok.

Now while the program is into the listening mode (hidden insite the taskmanager) I want to put it back into focus with a Key (or key combination)

This are some topics, but none that I can get to work.

  1. SetKey( K_ALT_T, { || MyFunction() } )

  2. SETKEY(ASC("Y"), {|| IIF(GetKeyState(VK_CONTROL), EVAL( {|| MyFunction (oTimer,oMain) } ), NIL) } )

The 2. version works when the program is visible (not HIDDEN).

Witch command is used to get the program back from hidden-status to the front window?

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: Recall a HIDDEN window from taskmanager

Posted: Tue Mar 28, 2017 09:22 PM
Did you try

Code (fw): Select all Collapse
oMain:Show()


?

EMG
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM

Re: Recall a HIDDEN window from taskmanager

Posted: Tue Mar 28, 2017 10:10 PM
But how to activate it insite the program ?

I cropped a sample to run. If you create a text file "test.dat" in the sample folder and put some data into it like " 00320123456789"
then the sample while popup a simple msg. If you remove the test.dat file, the program keeps listening until you put it back (this process of deleting the file and put it back is automated, but not in this sample)

It is used to popup a customed dialog when a phonecall is coming in. Afther the call the msg will be deleted and the program keeps on checking for the file.

I do want to activate the program with a HOT-key like ctrl-Y of ctrl-T.

here the sample

Code (fw): Select all Collapse
#include "fivewin.ch"

FUNCTION MAIN()
LOCAL oMain, oTimer, oButton, oStr1, oFont1, aGrad, oBtn, oMenu

//SetKey( K_ALT_T, { || MyFunction() } )
//SETKEY(ASC("Y"), {|| IIF(GetKeyState(VK_CONTROL),  EVAL( {|| MyFunction (oTimer,oMain) } ), NIL) } )
SETKEY(ASC("Y"), {|| IIF(GetKeyState(VK_CONTROL),  EVAL( {|| oMain:show() } ), NIL) } )

DEFINE WINDOW oMain FROM 150 , 150 TO 500 , 500 PIXEL
DEFINE TIMER oTimer OF oMain INTERVAL 1000 ACTION ( Listen( oTimer,oMain ) )

DEFINE BUTTONBAR oBar OF oMain _3D SIZE 64,64 2007

// say no where needed
@ 7 , 5 SAY oStr1 PROMPT "Not Needed Say" OF oMain

// use the HIDDEN so it's working in the background
ACTIVATE WINDOW oMain HIDDEN ON INIT ( OTimer:Activate() )

//ACTIVATE WINDOW oMain ON INIT ( OTimer:Activate() )

RELEASE TIMER oTimer
RETURN NIL

FUNCTION Listen( oTimer,oMain )
LOCAL cFile    := "test.dat"
LOCAL cString  := ""
oTimer:deactivate()

IF FILE( cFile ) .and. len(MEMOREAD( cFile )) > 2
   cString := MEMOREAD( cFile )
   msginfo(cString)
   //ShowcustData()
ENDIF
oTimer:activate()

RETURN NIL


//-------------------------------------------

function MyFunction(oTimer,oMain)
  oTimer:deactivate()
  msginfo("Test")
  oTimer:activate()
return NIL

//-------------------------------------------
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: Recall a HIDDEN window from taskmanager

Posted: Wed Mar 29, 2017 07:48 AM
Try with:

Code (fw): Select all Collapse
oMain:bKeyDown = { | nKey | If( ..., oMain:Show(), ) }


EMG
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM

Re: Recall a HIDDEN window from taskmanager

Posted: Wed Mar 29, 2017 09:35 AM

I will give it a try, but since the program is hidden in the background processes, it will not know that a key is pressed ?

Is'nt a HOT-KEY combination needed?

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: Recall a HIDDEN window from taskmanager

Posted: Wed Mar 29, 2017 09:38 AM
Marc Venken wrote:I will give it a try, but since the program is hidden in the background processes, it will not know that a key is pressed ?

Is'nt a HOT-KEY combination needed?


Don't know, sorry.

EMG

Continue the discussion