Hide window from taskbar? (in multi window app)

Hi!
I have a multi-window app and I would like to hide (and show) the sub-windows of my project whenever I need. Is that Possible?
I’m on windows 10 and the project is based on the example “multiWindowExample”.

Side note: I can’t just set the position of the window out of the screen because it will be still listed in the taskbar.

Any hint will be very appreciated.
Thanks!

I just found out a method and I’ll leave it here for those who may have the same problem.

  1. Each window (that you want to show or hide) has to have a variable of type “GLFWwindow” to refer to. For example, in the “multiWindowExample” that comes with oF, you can add something like this to the class “GuiApp.h” (just below “ofxPanel gui:”):
    GLFWwindow * window1:

  2. Now you can access to that window with that reference (“window1”).
    So, you can hide “window1” from the main app (ofApp.cpp) with just:
    glfwHideWindow(window1);

and you can show it again with:
glfwShowWindow(wind);

Hope someone find this usefull. cheers!

Hi,

I’m trying this in Windows

GLFWwindow *myOhmy = (GLFWwindow*) ofGetWindowPtr();
glfwHideWindow(	myOhmy );

In main.cpp:

ofAppGLFWWindow* win = new ofAppGLFWWindow();
ofSetupOpenGL(win, 800, 250, OF_WINDOW);
ofRunApp( new ofApp());

Unfortunately I’m not getting the window to hide. Any tips?
Thanks!

Hi Regi,
I’m not on my computer right now, so I can’t test it.
I suggest you to open the ‘multiWindowExample’ that comes with openFrameworks and try adding the lines I explained above. If you can make it work there, then you can add it to your project.

yeh, this doesn’t work, at least not in the 0.11 version of OF.

Hmm the following works for me on macOS on 0.11.0

Modifying the multiWindowOneAppExample:

ofApp.cpp

#include "ofApp.h"
#include "GLFW/glfw3.h"

//--------------------------------------------------------------
void ofApp::setup(){
	ofBackground(255);
	ofSetCircleResolution(200);
}

//--------------------------------------------------------------
void ofApp::setupGui(){
	parameters.setName("parameters");
	parameters.add(radius.set("radius",50,1,100));
	parameters.add(color.set("color",100,ofColor(0,0),255));
	gui.setup(parameters);
	ofSetBackgroundColor(0);
}

//--------------------------------------------------------------
void ofApp::update(){
	auto glfwWin = dynamic_pointer_cast<ofAppGLFWWindow>(guiWindow);

	if( ofGetFrameNum() % 200 == 100 ){
		glfwHideWindow(glfwWin->getGLFWWindow());
	}else if( ofGetFrameNum() % 200 == 199 ){
		glfwShowWindow(glfwWin->getGLFWWindow());
	}
}

Add to ofApp.h

		//inside of ofApp class 
		shared_ptr<ofAppBaseWindow> guiWindow;

main.cpp

#include "ofMain.h"
#include "ofApp.h"
#include "ofAppGLFWWindow.h"

//========================================================================
int main( ){
	ofGLFWWindowSettings settings;
    settings.setSize(600, 600);
	settings.setPosition(glm::vec2(300,0));
	settings.resizable = true;
	shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings);

    settings.setSize(300, 300);
	settings.setPosition(glm::vec2(0,0));
	settings.resizable = false;
	// uncomment next line to share main's OpenGL resources with gui
	//settings.shareContextWith = mainWindow;
	shared_ptr<ofApp> mainApp(new ofApp);

	mainApp->guiWindow = ofCreateWindow(settings);
	mainApp->guiWindow->setVerticalSync(false);

	mainApp->setupGui();
	ofAddListener(mainApp->guiWindow->events().draw,mainApp.get(),&ofApp::drawGui);

	ofRunApp(mainWindow, mainApp);
	ofRunMainLoop();

}

If the above doesn’t work for you, you could always use:

HWND ofAppBaseWindow::getWin32Window() 

paired with:

Which would let you show / hide the window using the HWND

Hope that helps!
Theo

1 Like