-
Ws_popup
In a program i am working on i need a new window that pops up and has no border or title bar. I used a WS_POPUP style as it is perfect with no title bar, no boarder, just a plain window. But i need to allow the user to be able to move it around as with normal windows. however the WS_POPUP is static... So how do i go about creating this. i know its simple, i've just never done this, nor can i find any information on it.
-
I don't have an answer for you, sorry, but i sure would be interested in knowing this too.
-
I don't think there's a 'style' you can give a window to do this, however it's would be pretty easy to implement it. This will move a popup window (300x300) while the left mouse button is held down, and should give you some ideas -
Code:
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
static POINT pWindowOrigin = {0,0};
static POINT pMouseOrigin = {0,0};
static POINT pMouseDestination = {0,0};
static BOOL bWindowMoving=FALSE;
switch (message)
{
case WM_LBUTTONDOWN:
bWindowMoving=TRUE;
//Ensure mouse input isn't lost
//if leaves client area
SetCapture(hWnd);
pMouseOrigin.x=LOWORD(lParam);
pMouseOrigin.y=HIWORD(lParam);
break;
case WM_LBUTTONUP:
bWindowMoving=0;
ReleaseCapture();
break;
case WM_MOUSEMOVE:
if(bWindowMoving)
{
pMouseDestination.x=LOWORD(lParam);
pMouseDestination.y=HIWORD(lParam);
int x= pMouseDestination.x-pMouseOrigin.x;
int y= pMouseDestination.y-pMouseOrigin.y;
pWindowOrigin.x+=x;
pWindowOrigin.y+=y;
MoveWindow(hWnd,pWindowOrigin.x,pWindowOrigin.y,
300,300,TRUE);
}break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
-
You could try using a dialog that pops up. You can create it without a boarder and titlebar. I have used the resource editor to do this before.