You can create a window with no caption bar, for example
CreateWindow(className, title, WS_THICKFRAME | WS_POPUP, ...)
Then override WM_NCHITTEST
to change the requests for moving the window up and down.
If window has caption bar, for example:
CreateWindow(className, title, WS_OVERLAPPEDWINDOW, ...)
Then add override for WM_WINDOWPOSCHANGING
as well:
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_NCHITTEST:
{
LRESULT lresult = DefWindowProc(hwnd, msg, wParam, lParam);
switch (lresult)
{
case HTTOP: lresult = HTCLIENT; break;
case HTTOPLEFT: lresult = HTLEFT; break;
case HTTOPRIGHT: lresult = HTRIGHT; break;
}
return lresult;
}
case WM_WINDOWPOSCHANGING:
{
WINDOWPOS* wndpos = (WINDOWPOS*)lParam;
wndpos->y = 100;//choose a fixed position
break;
}
...
}
return DefWindowProc(hwnd, msg, wParam, lParam);
}