; insert this in your WM_INITDIALOG or WM_CREATE
; hWin == handle of window
; hMenu == handle for menu

invoke GetSystemMenu, hWin, 0
mov hMenu, eax
invoke GetMenuItemCount, eax
dec eax
push eax
invoke RemoveMenu, hMenu, eax, MF_REMOVE or MF_BYPOSITION
pop eax
dec eax
invoke RemoveMenu, hMenu, eax, MF_REMOVE or MF_BYPOSITION
invoke DrawMenuBar, hWin


Why does this remove the 'X' too? The 2 removes are for the "Close\tALT+F4" and for the separator above it, right?

... so :confused:
Posted on 2002-11-28 15:47:54 by wicr0s0ft
try this,


invoke GetSystemMenu, hWin, FALSE
invoke DeleteMenu , eax, SC_CLOSE, MF_BYCOMMAND

this doesn't remove 'X' but only disables.

Regards
Posted on 2002-11-28 19:34:34 by cakmak

try this,


invoke GetSystemMenu, hWin, FALSE
invoke DeleteMenu , eax, SC_CLOSE, MF_BYCOMMAND

this doesn't remove 'X' but only disables.

Regards


The above code from the FAQ disables it aswell ("remove" was the wrong word I used).

And it disables the "X" because the system menu of a window is linked with the buttons in the titlebar... a bit weird but hey, it works! :grin:
Posted on 2002-11-29 00:48:35 by bazik
From API reference:
The DeleteMenu function deletes an item from the specified menu. If the menu item opens a menu or submenu, this function destroys the handle to the menu or submenu and frees the memory used by the menu or submenu.
The RemoveMenu function deletes a menu item from the specified menu. If the menu item opens a drop-down menu or submenu, RemoveMenu does not destroy the menu or its handle, allowing the menu to be reused. Before this function is called, the GetSubMenu function should retrieve the handle of the drop-down menu or submenu.


My questions: why do you use RemoveMenu, bazik, if you don't reuse the menu item? Wouldn't be better to delete it and free that unused memory?? :)

And could one (guess who? ;)) reuse the "close" menu item, for whatever is on his mind? And together the would do that assigned task too?
Posted on 2002-12-02 16:53:05 by wicr0s0ft