I'm creating a simple commandline applicatiation that starts a GLUT window.
I need that GLUT window to be always on top and remove the titlebar.
Basically GLUT does not provide anything for this so i'm looking into other options. On Windows i would do something like:
glutCreateWindow( "dpd" ); //create window with glut
HWND hwnd = FindWindow( "GLUT", "dpd" );
SetWindowPos( hwnd, HWND_TOPMOST, NULL, NULL, NULL, NULL, SWP_NOREPOSITION | SWP_NOSIZE ); //set the window always-on-top
But how can i do such a thing on OSX? (C++)
I already use some Carbon code to remove the menubar, but the titlebar is still visible:
SetSystemUIMode(kUIModeAllHidden,KWindowNoTitleBarAttribute);
i'm new to OSX development and out of ideas..
thanks
Ok, i found out that there is now way to make changes / ajustments to a glut window. So i finaly created a workaround: i start glut on one thread, on an other thread i created a fullscreen window with a transparent background and created a dynamic backgroundimage (png) with a viewport with just the size of the GLUT window without the titlebar. Sound kind a ugly but hey, it works, the client does get the result they want within budget :)
If you think there is a better solution for this without creating a manual openGL implementation please let me know!
Related
I have a regular Win32 window, I want to render using OpenGL only to part of that window, I found this question:
Using OpenGL in a regular window (Win32)
But I don't really know how they created a panel inside a window and got the DC for it..
Basically I want a window that will draw buttons, lists and more using win32 and on the same window, in some specified section, render opengl stuff.
I tried using glScissor and clearing the buffers but that just fills the whole screen with black and the part I specified in the clear color..
I also tried using glViewport but that didn't do anything.
I ended up creating a new widget like so:
HWND OpenglHWND = CreateWindowW(L"Static", L"",
WS_CHILD | WS_VISIBLE | WS_BORDER,
200, 10, 300, 300, ParentWindowHandle, 0, 0, NULL);
After that, you got the HWND of the panel you created, from here just initialize OpenGL like you always do, BUT, when creating the context, use the DC of the HWND we got before! (basically use GetDC(OpenGLHWND) for the OpenGL context)
You'd need to create a WinForms Panel control (assuming you are using WinForms?) then call GetDC(panel.Handle) passing the Handle property of the panel as a parameter. This will give you the DC to create the OpenGL context.
I'm creating a window in C++ with that code:
HWnd = CreateWindow(wc.lpszClassName,
"myapp",
WS_POPUP |WS_VISIBLE,
10, 10, 1000, 800, 0, 0, hInst, NULL);
It appears as I want but when I maximize it with like this:
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
then it's like a fullscreen window so that the taskbar is hidden.
I think it's because it is a POPUP window but this is like I want it to appear.
Do I need to create my own maximize function or is there a parameter to avoid that ?
Thanks
You can add WS_CAPTION | WS_SYSMENU | WS_MAXIMIZEBOX style.
If you want your window to be without caption then you will need to adjust window size manually to fit into desktop work area that you can query using SystemParametersInfo specifying SPI_GETWORKAREA flag.
This is a feature where the Taskbar will get out of your full-screen application:
If you want to create a fullscreen window that covers the taskbar, just create a fullscreen window and the taskbar will automatically get out of the way.
I’ve seen people hunt for the taskbar window and then do a ShowWindow(hwndTaskbar, SW_HIDE) on it. This is nuts for many reasons.
Don’t do any of this messing with the taskbar. Just create your fullscreen window and let the taskbar do its thing automatically.
Since this is Stackoverflow, a combination of Wikipedia and Reddit, i want this relevant information saved for the next guy asking this question.
I'm working on a DirectX GUI library, and the main class works by creating a main window, and then porting the input to all the GUI windows, which will handle the events. The problem is, the main window is a Win32 window (to handle messages), and needs to be invisible. Is there a way to create and invisible window and then be able to handle messages and draw things with DirectX?
In the WM_CREATE of your WindowProc, do:
ShowWindow( hwnd, SW_HIDE );
I will try to explain my problem the best i can,
I'm creating a layered window in c++ (using windowsXP), all works fine until i drag my created window near the windows start button, and then when i press the star button of windows taskbar and close it again all the windows beneath of my layered window aren't being painted (only in the area of the start window that pops over my window).
My create window is like this:
CWnd::CreateEx( WS_EX_TOOLWINDOW |
WS_EX_LAYERED,
AfxRegisterWndClass(0),
lpstr_name, WS_POPUP, 0,0,0,0,
pc_parent->GetSafeHwnd(), 0);
...
When i create the window with this styles the problem ocurrs, but if i create with the extended style WS_EX_TRANSPARENT and all the others the problem does not occur any more. And if instead of a WS_POPUP window is a WS_CHILD or WS_OVERLAPPED then this also doesn't occur...
Can anyone please explain why when i create a WS_POPUP window with the WS_EX_LAYERED style all the beneath windows aren't updated, and if i add the style WS_EX_TRANSPARENT this works fine.
Note: why i do not use the WS_EX_TRANSPARENT style if it works right? if i use it then my window can not be dragged and i need it to do it :)
Updated:
alt text http://img17.imageshack.us/img17/586/clipboard01il.jpg
The image above is to describe better what is happening:
The first part of the image you can see my leyered window and beneath is the vs, in the second img i press the start button and then in the last image i already drag my layered window to the right and you can see that the vs window does not updates the affected area.
Note that this situation until now only occurs with the start window?! with other windows it does not happen!?...
Thanks
only in the area of the start window that pops over my window
That's expected. Only that clipping rectangle is obscured by the start menu so only that region will be repainted. What behavior are you expecting? If there are windows covered by more upper level windows, then they won't be repainted either -- why repaint something just to paint over it?
All underneath windows need to get repainted though if you use transparent because GDI can't calculate the final color of the pixel without knowing the area below the window's color.
I am creating a program that displays a popup at certain times (just like some chat clients for example) on which the user can click. However, I do not want to take away the focus from the current application.
The way I'm doing it now is by using a HWND with WS_POPUPWINDOW and minimizing and then restoring the window. However, this steals the focus from the current application. Setting foreground or hiding and showing a window did not make it appear on the foreground. I would like to be able to keep using a HWND so I can use other elements in this window, but I have no idea how to give it foreground without stealing focus.
I use win32 and c++.
To show without activating:
ShowWindow(hwnd, SW_SHOWNOACTIVATE);
To raise without activating:
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
Unfortunately this is not working for me. The window is created with CreateWindowExA and is showed using ShowWindow(hwnd, SW_SHOWNOACTIVATE) however the keyboard focus is still stolen from the window which has the focus at the moment of the creation. (The window is created with layered and trasparent attributes by using SetWindowLong() and SetLayeredWindowAttributes() ).
PS: The window which has the focus is not parent of the new created window.
Solved: It worked when I removed the SetForegroundWindow call. This function cause the window passed as parameter to be activated.