Creating a window without borders

Archives Forums/Win32 Discussion/Creating a window without borders

agent4125(Posted 2007) [#1]
I'm trying to create a small loading window without borders.

When I disable the caption (which includes the borders) on the active window, it looks like the old window rendering pane remains underneath.

This old area has either garbage or a blank area. Since it includes the dimensions of the old caption and border, it spills out to the right and bottom of the active area.

Not sure if this is a Max bug or I'm missing a WinAPI call.

Thanks!


Strict

Graphics 320, 200

SetClsColor 0,64,0

RemoveBorder()
DrawMsg("Press Key to flip once")
DrawMsg("Press Key to Exit")


Function RemoveBorder()

	Local hWnd:Long = GetActiveWindow()

	Local tmp:Long = GetWindowLongA( hWnd, GWL_STYLE )
	tmp :~ WS_CAPTION

	SetWindowLongA( hWnd, GWL_STYLE, tmp )

End Function


Function DrawMsg (msg$)

    Cls
    SetColor 255,255,255
    DrawText msg$, 50, 50
    Flip

    WaitKey()

EndFunction



grable(Posted 2007) [#2]
You need to update the window after a style change, adding this:
SetWindowPos( hwnd, 0, 0,0, GraphicsWidth(),GraphicsHeight(), SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED)

After the SetWindowLongA call should do it


agent4125(Posted 2007) [#3]
That did it. Thanks, grable!