Page 1 of 1

Hide Xbase++ application

Posted: Tue Jun 05, 2012 6:34 am
by dougtanner
How can I hide an xBase++ application so it is not visible on the desktop and on the windows task bar. I want an application to wake up when a file appears at a network location.

Doug

Re: Hide Xbase++ application

Posted: Tue Jun 05, 2012 6:43 am
by Tom
Create the app as a service (look at ..\XPPW32\source\samples\apps\SimpleService).

Re: Hide Xbase++ application

Posted: Tue Jun 05, 2012 6:45 am
by Tom
Another solution: DCGET OPTIONS ... NOTASKLIST. This will prevent your app from to be shown in the task list. DCGET OPTIONS ... HIDE will hide the dialog unless oDialog:Show() is called (DCREAD GUI ... PARENT @oDialog).

Re: Hide Xbase++ application

Posted: Tue Jun 05, 2012 7:39 am
by rdonnay
I think this is what you want:

Code: Select all

#INCLUDE "dcdialog.CH"

FUNCTION Main()

LOCAL GetList[0], oMenuBar, oMenu1, oMenu2, oDlg, GetOptions

DCMENUBAR oMenuBar
  DCSUBMENU oMenu1 PROMPT 'File' PARENT oMenuBar
    DCMENUITEM 'New' PARENT oMenu1
  DCSUBMENU oMenu1 PROMPT 'Edit' PARENT oMenuBar
    DCMENUITEM 'New' PARENT oMenu2

DCGETOPTIONS HIDE
DCREAD GUI TITLE 'Wakeup Test' OPTIONS GetOptions PARENT @oDlg ;
   EVAL {|o|o := Thread():new(),Sleep(5),o:start({||Check4WakeUp(oDlg)})}

RETURN nil

* --------------

PROC appsys ; return

* --------------

STATIC FUNCTION Check4WakeUp( oDialog )

DO WHILE .t.
   Sleep(100)
   IF FExists('Wakeup.Txt') 
     IF !oDialog:isVisible()
       oDialog:show()
     ENDIF
   ELSEIF oDialog:isVisible()
     oDialog:hide()
   ENDIF
ENDDO

RETURN nil

Re: Hide Xbase++ application

Posted: Wed Jun 06, 2012 5:22 am
by dougtanner
Thanks Roger,

That code does what I wanted to do. I like Tom's idea of creating a service too.

Doug

Re: Hide Xbase++ application

Posted: Wed Jun 06, 2012 5:39 am
by Tom
Doug,

services are limited if they try to interact with the desktop. Network shares and other installed hardware may not be visible to services. This is an elegant solution for lots of issues, but it may not be first choice for everything.

Re: Hide Xbase++ application

Posted: Wed Jun 06, 2012 9:08 am
by bwolfsohn
We have tried and failed numerous times to create a service with a built-in UI. We ended up building two separate apps to communicate, a service and a UI. The service app if for multiple services, each on it's own tab.. it's based on roger's service app (which doesn't run as an actual service). It's a maintenance/debugging nightmare when trying to deal with messaging between the apps..

Brian