Skip to content

Instantly share code, notes, and snippets.

@MartinBspheroid
Last active November 16, 2022 05:39
Show Gist options
  • Save MartinBspheroid/8902181 to your computer and use it in GitHub Desktop.
Save MartinBspheroid/8902181 to your computer and use it in GitHub Desktop.
openFrameworks hacks (win64)
// TESTED ON nightly-build ver 0.8 (of_v20130813) in Visual Studio 2012 - Win64
// MAKE APP ALWAYS ON TOP
HWND AppWindow = GetActiveWindow();
SetWindowPos(AppWindow, HWND_TOPMOST, NULL, NULL, NULL, NULL, SWP_NOMOVE | SWP_NOSIZE);
// DISABLE FUNCTION DESCRIBED ABOVE
HWND AppWindow = GetActiveWindow();
SetWindowPos(AppWindow, HWND_NOTOPMOST, NULL, NULL, NULL, NULL, SWP_NOMOVE | SWP_NOSIZE);
// GRAB AND MOVE WINDOW BY WINDOW ITSELF
// CALL THIS IN UPDATE
void testApp::ofMoveWindow(){
// movingWindow is boolean, set to TRUE if mouse is pressed in certain are by mousePressed()
// and is set to false each time in mouseReleased()
if (movingWindow)
{
POINT p;
GetCursorPos(&p);
// mwpx & mwpy are global variables changed by mousePressed()
SetWindowPos(windowHandle, NULL, p.x-mwpx, p.y-mwpy, 0, 0, SWP_NOSIZE);
}
}
// SET WINDOW TO BORDERLESS (no decoration, or buttons to close/minimize, or resize)
// !! NOTICE - THIS WILL CAUSE RECOMPILING openFrameworks, AS IT REACHES TO CORE FUNCTIONS!!!
// IN ofAppGLFW.cpp inside ofSetupOpenGL()
glfwWindowHint(GLFW_RED_BITS, rBits);
glfwWindowHint(GLFW_GREEN_BITS, gBits);
glfwWindowHint(GLFW_BLUE_BITS, bBits);
glfwWindowHint(GLFW_ALPHA_BITS, aBits);
glfwWindowHint(GLFW_DEPTH_BITS, depthBits);
glfwWindowHint(GLFW_STENCIL_BITS, stencilBits);
//add this line under code before
glfwWindowHint(GLFW_DECORATED,0); // <------------------------ / BORDERLESS SETUP
// REMOVE CONSOLE WINDOW
// in main.cpp add this line on top
#pragma comment(linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment