Recall a HIDDEN window from taskmanager

Recall a HIDDEN window from taskmanager

Postby Marc Venken » Tue Mar 28, 2017 8: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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1357
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium


Re: Recall a HIDDEN window from taskmanager

Postby Marc Venken » 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: Select all  Expand view

#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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1357
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Recall a HIDDEN window from taskmanager

Postby Enrico Maria Giordano » Wed Mar 29, 2017 7:48 am

Try with:

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


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8375
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Recall a HIDDEN window from taskmanager

Postby Marc Venken » Wed Mar 29, 2017 9: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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1357
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Recall a HIDDEN window from taskmanager

Postby Enrico Maria Giordano » Wed Mar 29, 2017 9: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
User avatar
Enrico Maria Giordano
 
Posts: 8375
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 36 guests