How to hide window define as top level form

Posted on 2011-10-11
Last Modified: 2012-08-14
I have small app in VFP. I wan't to hide the main window(first form) aftre running and put icon in the system tray. I'm using FoxTray.ocx to achive system tray icon. My main form is set to:
-desktop = .F.
-showWindow = 0
-WindowType = 0

In activate method of the form i have: "HIDE WINDOW SCREEN"

This working quite well. But when I activate the main form the MainVFP Window show.
What i try to do is to show only the form(without VFPMainScreen) when i click trayIcon and hide it when i click my own "hide" button.

When I use showWindow=2 top-level I can hide main VFP screen but can't hide this top-level form.

Question by:dan_leniwiec
    LVL 27

    Expert Comment

    If you wish to hide it after execution then use this:
    _SCREEN.Visible = .F.

    If you wish to hide it before launching the application, I suggest to create a config.fpw file in the same folder as the executable and in it put:

    Author Comment

    but that wan't hide top-level form...

    Author Comment

    I find the solution. Mayby not the best but working ;)

    I set my main program form called "MainForm", ShowWindow = 2 as-top-level-form.
    At the beggining I set _screen.visible = .F.
    And after invoking the form, but before read events I do "HIDE WINDOW ALL" (here should be something like 'HIDE WINDOW 'MainForm'')
    When i want to show the form I invoke "SHOW WINDOW ALL" and HIDE WINDOW SCREEN.

    Still don't know how to use properly - HIDE WINDOW 'MainForm'...someone know ?
    LVL 27

    Expert Comment

    SHOW and HIDE WINDOW are for older versions of FoxPro.

    You should be using Form.Visible = .F. or .T.
    _SCREEN.Visible = .F.
    Application.Visible = .F.

    Author Comment

    None of them work with my app.
    Only _screen.visible

    Could you please tell me where i should put these  lines ?
    LVL 27

    Accepted Solution

    SCREEN=OFF you put it in a config.fpw file. You create this file using this
    MODIFY FILE c:\path\config.fpw

    You also put this file in the project when you build the application.

    This will prevent the Main FoxPro window (_SCREEN) from showing when you click on the icon of the software.

    When you wish to activate a screen, the click or double click event of the tray icon should have Visible = .T. or Form.Show.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
    Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now