Archived

This topic is now archived and is closed to further replies.

JoeZ

switch from overlappwindow to popupwindow

Recommended Posts

Hi: I notice that in winapi it is possible to switch the style of a window from pop-up to overlapped during runtime. I try hard to do the reverse but can''t get it to work. The title bar still exsits. Is it possible to switch from a overlapped style to a popup style(just a sqare- no frame no title bar) during runtime? Thanks

Share this post


Link to post
Share on other sites
haven't tested it, but anyways:>

SetWindowLong(hWnd, GWL_STYLE, WS_POPUP);
UpdateWindow(hWnd);

might wanna hide the window before calling the setwindowlong function and then show it again, to be sure it's really repainted.

[edited by - pag on May 1, 2003 10:15:12 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
i''ve been using the following code with 9x through XP apps w/o problems:

  
void weWnd::SetFrame( bool borderless, bool menu )
{
if( m_hWnd == NULL )
return;

HMENU hMenu;
LONG style = GetStyle();
LONG exStyle = GetExStyle();
RECT clntRect = GetClientRect();

if( borderless )
{
style = WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS;
exStyle &= ~(WS_EX_WINDOWEDGE);
}
else
{
style = WS_OVERLAPPED | WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPSIBLINGS;
exStyle |= WS_EX_WINDOWEDGE;
}

if( menu )
hMenu = m_hMenuSave;
else
hMenu = (HMENU)NULL;

SetMenu(hMenu);
SetStyle(style);
SetExStyle(exStyle);

::AdjustWindowRectEx(&clntRect, style, menu, exStyle);

SetSize(clntRect.right-clntRect.left, clntRect.bottom-clntRect.top);
}

the Get and Set functions are internal to the class but hopefully it''s obvious what they do.

Share this post


Link to post
Share on other sites