Hide taskbar or real fullscreen


#1

Good day.
I need to hide taskbar and hide system mouse cursor.
Waiting for your replying.


#2

you can look here there are a couple of functions that can be useful to you to get a full screen mode (win32 only).

http://svn.berlios.de/wsvn/ejuce/trunk/src/ejuce_core/misc/ejuce_SystemUtilities.cpp?op=file&rev=0&sc=0


#3

ah i forgot you can also check Component::enableUnboundedMouseMovement method…


#4

Thanks. But I have sensor screen. So I want to hide mouse and taskbar.
Many thanks for replying.


#5

[code]bool SystemUtilities::isTaskbarVisible()
{
// return ejuce_isTaskbarVisible ();

    bool isVisible = false;

    HWND tray = FindWindow("Shell_TrayWnd", "");
    if( tray )
    {
            isVisible = (IsWindowVisible(tray)==0) ? false : true;
    }

    return isVisible;

}

void SystemUtilities::showWindowsTaskbar(bool tryToShow)
{
// ejuce_showWindowsTaskbar (tryToShow);

    RECT rectWorkArea = {0,0,0,0};
    RECT rectTaskBar = {0,0,0,0};

    HWND tray = FindWindow("Shell_TrayWnd", "");

    // Code to Hide the System Task Bar
SystemParametersInfo(SPI_GETWORKAREA,
                  0,
                  (LPVOID)&rectWorkArea,
                  0);

    if( !tryToShow )
    {
            if( tray && IsWindowVisible (tray) != 0 )
            {
                    GetWindowRect(tray, &rectTaskBar);

                    if ((rectTaskBar.top <= 0 && rectTaskBar.left <= 0) &&
                            rectTaskBar.right < rectTaskBar.bottom)
                    {
                            // task on left
			rectWorkArea.left = 0;
                    }
                    else
                    if ((rectTaskBar.top <= 0 && rectTaskBar.left <= 0) &&
                            rectTaskBar.right > rectTaskBar.bottom)
                    {
                            // task on top
			rectWorkArea.top = 0;
                    }
                    else
                    if (rectTaskBar.left > 0 && rectTaskBar.top < 0)
                    {
                            // task on right
			rectWorkArea.right = rectTaskBar.right - 2;
                    }
                    else
                    if (rectTaskBar.left <= 0 && rectTaskBar.top > 0)
                    {
                            // task on bottom
			rectWorkArea.bottom = rectTaskBar.bottom - 2;
                    }

                    SystemParametersInfo(SPI_SETWORKAREA,
                                                    0,
                                                    (LPVOID)&rectWorkArea,
                                                    SPIF_SENDCHANGE);

                    ShowWindow(tray,SW_HIDE);
            }
    }
    else
    {
            if( tray && IsWindowVisible (tray) == 0 )
            {
                    GetWindowRect(tray, &rectTaskBar);

                    if ((rectTaskBar.top <= 0 && rectTaskBar.left <= 0) &&
                            rectTaskBar.right < rectTaskBar.bottom)
                    {
                            // task on left
			rectWorkArea.left = rectTaskBar.right;
                    }
                    else
                    if ((rectTaskBar.top <= 0 && rectTaskBar.left <= 0) &&
                            rectTaskBar.right > rectTaskBar.bottom)
                    {
                            // task on top
			rectWorkArea.top = rectTaskBar.bottom;
                    }
                    else
                    if (rectTaskBar.left > 0 && rectTaskBar.top < 0)
                    {
                            // task on right
			rectWorkArea.right = rectTaskBar.left;
                    }
                    else
                    if (rectTaskBar.left <= 0 && rectTaskBar.top > 0)
                    {
                            // task on bottom
			rectWorkArea.bottom = rectTaskBar.top;
                    }

                    SystemParametersInfo(SPI_SETWORKAREA,
                            0,
                            (LPVOID)&rectWorkArea,
                            SPIF_SENDCHANGE);

                    ShowWindow(tray,SW_SHOW);
            }
    }

}[/code]

then you can do win32 stuff ::ShowCursor (FALSE); … but don’t tell the other guys, we are in juce forum… not winzoze… ehe


#6

Thanks again.
Next code works fine.

HWND tray = FindWindow(T("Shell_TrayWnd"), T(""));
	ShowWindow(tray, SW_HIDE);
	::ShowCursor(FALSE);

Best regards :slight_smile:


#7

yeah. but have you tried doing setFullScreen on a juce window when the taskbar is hidden? you cannot work on the whole screen… hidden taskbar is occuping some space on the desktop, in other words the working desktop area is smaller than the size of the monitor resolution…


#8

Yes you’re right. Thanks. I’ll use your code.


#9

If you’ve got a load of components on-screen and want to hide the mouse for all of them, what I’d do is to put a big transparent component over the top of the whole lot, and use Component::setMouseCursor (MouseCursor::NoCursor) so that it has no mouse cursor. Then you can hide or show the cursor by making this component visible or invisible. Much nicer than hacking it with win32 calls!


#10

jules, you’re right. anyway have you considered the possibility of changing the desktop monitor working area ? i don’t know how linux, macos treat that, but on winzoze this will come in handy if you want to work in full screen mode (and so not see the taskbar) as jaques needs and me too in some cases. i’ve written that SystemUtilities wrapper that does nothing more than calling the platform functions for that, but actually the linux/macosx implementation is empty…


#11

No, there’s no need for anything like that.

You can already make a window fill the screen if you set it to the entire screen size and make it always-on-top. Try hacking line 79 of juce_Desktop.cpp to

juce_updateMultiMonitorInfo (monitorCoords, false);

and run the juce demo - it’ll cover the taskbar when it’s fullscreen. Works on all platforms, too. I’ve not made this public, but it could be an option.


#12

ah ok. nice. but i will obtain this only hacking juce_Desktop.cpp ? i prefer not touching your files if is not needed.


#13

Thanks, I’ll try. Also I saw problems with global MouseListener.
My application is catching mouse clicking. And after some timeout it become in sleep mode (if no user activity). So, some times on Windows XP SP1 it works only if window isn’t active (Focus on another windows application). What do you think about it?


#14

[quote=“jacque”]Thanks, I’ll try. Also I saw problems with global MouseListener.
My application is catching mouse clicking. And after some timeout it become in sleep mode (if no user activity). So, some times on Windows XP SP1 it works only if window isn’t active (Focus on another windows application). What do you think about it?[/quote]

…sorry, I don’t really understand what you mean? What’s not working?


#15

Ok. When user click mouse I save timestamp. And timer verify it. If timeout is present application come to sleep mode. In sleep mode slideshow is started. So. Sometime I saw the slideshow only if main window loses focus. :slight_smile: But, it’s my own problem i’ll log all actions and timestamps and find what is the problem. Many thanks for your attention.


#16

Yes, doesn’t really sound like a problem with Juce.

What’s the app? Anything exciting?


#17

We call it Mobile Fuel. It’s Win (I’ll try port it on linux) application. Which download multimedia through IrDA and Bluetooth to OBEX mobile phones.
Nothing especial. Thanks for your work. It was nice pleasure to develop with JUCE and SQLite3. The real problem was only with plaing midi.
Thanks.


#18

Well let me know the URL when it’s done, as I’m trying to collect together a bunch of links to Juce projects for a new section on my website.


#19

[quote=“jules”]No, there’s no need for anything like that.

You can already make a window fill the screen if you set it to the entire screen size and make it always-on-top. Try hacking line 79 of juce_Desktop.cpp to

juce_updateMultiMonitorInfo (monitorCoords, false);

and run the juce demo - it’ll cover the taskbar when it’s fullscreen. Works on all platforms, too. I’ve not made this public, but it could be an option.[/quote]

Should this really set the windows absolutly fullscreen and cover all OS specific stuff like the taskbar in windows and the dock on osx?

i have set this on line 82 and 83 on juce_Desktop.cpp

juce_updateMultiMonitorInfo (monitorCoordsClipped, false);
juce_updateMultiMonitorInfo (monitorCoordsUnclipped, false);

and then in the contructor of my documentWindow object i set

setAlwaysOnTop(true);
setFullScreen(true);
setVisible (true);

this does not work for me ;-(


#20

No, that’s not going to work - setting a window to fullscreen will try to use the OS’s fullscreen mode (i.e. a “polite” fullscreen that doesn’t cover the taskbar), so this isn’t affected by the sizes returned by the Desktop class.

For a true full-screen, you can just set your component’s bounds to be the size of the monitor, using Desktop::getMainMonitorArea (false).