I was asked to build a small app in openFrameworks that does a little animation, but to build it as a DLL that gets loaded into a larger application (built & controlled by someone else) and displayed in a new/separate window. I was wondering if there is a programmatic way to close the window I create from within my DLL, as the shell/container app will need to close out a loaded DLL & load a new one.
I start my window with this code, which is in a spawnWindow() method in my DLL, called externally by the parent:
ofAppGlutWindow window; ofSetupOpenGL(&window, 1024, 768, OF_WINDOW); ofRunApp(new myAnimation());
So, it’s spawning a new window in addition to a “discardable” dialog that the container/shell created from the windows.h C++ library.
I’ve tried calling the opengl utility toolkit method (which it looks like what openFrameworks is using under the hood) to destroy my window like this: glutDestroyWindow(glutGetWindow()), and that closes my DLL window, but it also kills the dialog for & closes the parent app that loads my DLL. But oddly enough, glutHideWindow() hides just my DLL window and leaves the shell/container’s dialog untouched.
When trying to destroy my window, I’m wondering if it’s taking down the whole program because there’s an openGL process in my spawned window to stop first? Or maybe destroyWindow() on my window is bubbling up to the parent’s dialog window somehow? But I don’t know how to debug for it since this is a DLL that gets loaded in to a compiled app that I don’t have the source for.
I’m new to C++, openFrameworks and openGL, so I’m not sure where to go from here.
I’d actually like to know how to clean up and/or kill off the openGL setup and process initiated by ofRunApp, too.
I’m using v0.7.4 on Windows 7 in Visual Studio 2010. The container/shell app is written in C++, but not openFrameworks.