04-05-2011, 06:32 AM
How can I disable the "x" close button from a window? This will be on a window that is already created! Is it possible? Anyway to disable the "x"?
Tried finding a style to set in msdn and use SetWinStyle but can't seem to find anything.
Found this C++ code, can you convert?
Macro Macro2
Tried finding a style to set in msdn and use SetWinStyle but can't seem to find anything.
Found this C++ code, can you convert?
Macro Macro2
HMENU hMenuHandle;
long lngItemCount;
int c, style;
hMenuHandle = GetSystemMenu(hWnd, false);
lngItemCount = GetMenuItemCount(hMenuHandle);
style = GetWindowLong(hWnd, GWL_STYLE);
style &= ~WS_MAXIMIZEBOX;
SetWindowLong(hWnd, GWL_STYLE, style);
c = lngItemCount;
while(c > lngItemCount - 4)
RemoveMenu(hMenuHandle, c--, MF_BYPOSITION | MF_DISABLED);
DrawMenuBar(hWnd);;As you can see this code will go in your window procedure under WM_CREATE. Just as a reminder, some systems have things added to the "standard" system menu so you will need to find a way of allowing for that.