Missing Close/Minimize/Restore Down buttons

My window is missing top-right three buttons (Close/Minimize/Restore)...

Here's how i create the window...

[code]
// MAIN
int WINAPI WinMain(HINSTANCE hInst,HINSTANCE hprevInst,LPSTR pStr,int nCmd)
{
TCHAR *classname=_T("RFS Range");
int height_frac = 250;
int desktopwidth;
int desktopheight;
MSG msg;
HWND hwnd;

WNDCLASSEX wcx={0};

wcx.cbSize = sizeof(WNDCLASSEX);
wcx.lpfnWndProc = WndProc;
wcx.hInstance = hInst;
wcx.hIcon = (HICON)LoadImage(0,IDI_APPLICATION,IMAGE_ICON,0,0,LR_SHARED);
wcx.hCursor = (HCURSOR)LoadImage(0,IDC_ARROW,IMAGE_CURSOR,0,0,LR_SHARED);
wcx.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
wcx.lpszClassName = classname;

if (!RegisterClassEx(&wcx))
{
ErrMsg(_T("Failed to register wnd class"));
return -1;
}

desktopwidth=GetSystemMetrics(SM_CXSCREEN);
desktopheight=GetSystemMetrics(SM_CYSCREEN);

hwnd=CreateWindowEx(0,
classname,
_T("RFS Range"),
WS_EX_OVERLAPPEDWINDOW,
desktopwidth/4,
desktopheight/4,
desktopwidth/2,
desktopheight/2 + height_frac,
0,
0,
hInst,
0);

[/code]



Comments

  • [code]hwnd=CreateWindowEx(0,
    classname,
    _T("RFS Range"),
    WS_EX_OVERLAPPEDWINDOW,
    desktopwidth/4,
    desktopheight/4,
    desktopwidth/2,
    desktopheight/2 + height_frac,
    0,
    0,
    hInst,
    0);[/code]

    There are two problems with this code. WS_EX_OVERLAPPEDWINDOW does NOT imply any standard window attributes (Like OVERLAPPEDWINDOW). Also, all _EX_ attributes are specified in the FIRST parameter of the above routine.

    Change your code to this and it should create a resizable window with a system menu:

    [code]hwnd=CreateWindowEx(WS_EX_OVERLAPPEDWINDOW,
    classname,
    _T("RFS Range"),
    WS_OVERLAPPEDWINDOW,
    desktopwidth/4,
    desktopheight/4,
    desktopwidth/2,
    desktopheight/2 + height_frac,
    0,
    0,
    hInst,
    0);[/code]
    [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS Operating System[rightbr][leftbr][link=http://www.brokenthorn.com]Website :: OS Development Series[rightbr][/link][/size]
  • : [code]: hwnd=CreateWindowEx(0,
    : classname,
    : _T("RFS Range"),
    : WS_EX_OVERLAPPEDWINDOW,
    : desktopwidth/4,
    : desktopheight/4,
    : desktopwidth/2,
    : desktopheight/2 + height_frac,
    : 0,
    : 0,
    : hInst,
    : 0);[/code]:
    :
    : There are two problems with this code. WS_EX_OVERLAPPEDWINDOW does
    : NOT imply any standard window attributes (Like OVERLAPPEDWINDOW).
    : Also, all _EX_ attributes are specified in the FIRST parameter of
    : the above routine.
    :
    : Change your code to this and it should create a resizable window
    : with a system menu:
    :
    : [code]: hwnd=CreateWindowEx(WS_EX_OVERLAPPEDWINDOW,
    : classname,
    : _T("RFS Range"),
    : WS_OVERLAPPEDWINDOW,
    : desktopwidth/4,
    : desktopheight/4,
    : desktopwidth/2,
    : desktopheight/2 + height_frac,
    : 0,
    : 0,
    : hInst,
    : 0);[/code]:
    : [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS
    : Operating
    : System[rightbr][leftbr][link=http://www.brokenthorn.com]Website ::
    : OS Development Series[rightbr][/link][/size]
    :
    Thanx MT... Something strange though, as soon as i resize the window by dragging the corners to a larger size, the window closes... This happens also when i drag the window...
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion