Search code examples
c++windowswinformswin32gui

Opening a window that has no title bar with Win32


I'm developing a C++ application for Windows. I'm using the Win32 API. How can I open a window without a title bar (without controls, icon and title) and that can not be resized.

The piece of code that I am using for the application to create a window:

hWnd = CreateWindow(szWindowClass, 0, (WS_BORDER),
                    0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, NULL, NULL, hInstance, NULL);

To do this in C#, you just define this code:

 FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
 ControlBox = false;

Solution

  • hWnd = CreateWindow(szWindowClass, 0, (WS_BORDER ), 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, NULL, NULL, hInstance, NULL); 
    
    SetWindowLong(hWnd, GWL_STYLE, 0); //remove all window styles, check MSDN for details
    
    ShowWindow(hWnd, SW_SHOW); //display window