Ws_popup

This is a discussion on Ws_popup within the Windows Programming forums, part of the Platform Specific Boards category; In a program i am working on i need a new window that pops up and has no border or ...

  1. #1
    Registered User The15th's Avatar
    Join Date
    Aug 2001
    Posts
    125

    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.
    arrh, i got nothing good to say.
    http://www.praxis1.vic.edu.au/home/dcola/

  2. #2
    Registered User DutchStud's Avatar
    Join Date
    Oct 2001
    Posts
    43
    I don't have an answer for you, sorry, but i sure would be interested in knowing this too.

  3. #3
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    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;
    }
    zen

  4. #4
    Registered User ski6ski's Avatar
    Join Date
    Aug 2001
    Posts
    133
    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.
    C++ Is Powerful
    I use C++
    There fore I am Powerful

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21