Disabling "X" button on Window
hi there,
I was told it was better to move this question here:
I've done a bit of research on how to disable the exit (X) button on the win32 app
this is what i came up with:
Code:
HMENU hMenuHandle; //declare HMUNU handle
long lngItemCount; //declare item count storage
int c, style; //declare c and style storage
//disable for EditMain
hMenuHandle = GetSystemMenu(EditMain, false);
lngItemCount = GetMenuItemCount(hMenuHandle);
//disable maximize button
style = GetWindowLong(EditMain, GWL_STYLE);
style &= ~WS_MAXIMIZEBOX;
SetWindowLong(EditMain, GWL_STYLE, style);
//disable 'X' button
c = lngItemCount;
while(c > lngItemCount - 4)
RemoveMenu(hMenuHandle, c--, MF_BYPOSITION | MF_DISABLED);
DrawMenuBar(EditMain);
the above code works great for the most part...it disables the maximize button and the "X" button but it casues my window (EditMain) to not be movable and it wont let my window minimize in windows NT...my windows can minimize in XP but still it is not movable around the screen.. I want my user to be able to move the window around and minimize.
what is it about my above code that is causing this?
or is there and even simpler way?
thanx in advance
Boomba,