Advertisement

Disabling the ALT menu in my game?

Started by February 27, 2000 11:09 PM
8 comments, last by SikCiv 24 years, 8 months ago
My game runs in both Window and Fullscreen, but whenever the ALT key is pressed, that annoying menu in the top left corner of the window comes up, u know the one with (Move, Size, Minimize, Maximize, Close). I tried using DInput to override it, but it didnt work. How do I disable it? My guess is u have to tell the window not to create a menu on initialisation.?.

  Downloads:  ZeroOne Realm

Make the Window A POPUP window, then it wont do that, I had that trouble Heres my code, from my game:

m_App->m_hwndMain = CreateWindow(
APP_NAME,
APP_NAME,
WS_POPUPWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
640,
480,
(HWND) NULL,
(HMENU) NULL,
hInstance,
(LPVOID) NULL);


later,
Advertisement
i am using WS_EX_APPWINDOW for windowed applications (has no close button and no system menu) and when i switch to fullscreen i completely destroy the window and set it up again with WS_POPUP which works fine in fullscreen with no border at all but seems to screw things up in windowed mode
Ridcully: Try the SetWindowLong() function, one of the flags allows you to change the window style, so you won''t have to destroy it each time.

Good Luck!


- null_pointer
thanks, but i already tried that and it did nothing much but screw up the window style a lot...
my whole engine is used to initialize each time i switch mode, and it works fine.
but i''ll try to do it with setwindowlong again and pin the blame on you if it won''t work
ridcully
If you want to disable system keys you can include the following code in your program:

int num = 0;
// disable system keys
SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1, #, 0);
// run your program here

// enable system keys again
SystemParametersInfo(SPI_SCREENSAVERRUNNING, 0, #, 0);

the problem is it only works on windows 95/98
Advertisement
Try trapping the SC_MENU message in WM_SYSCOMMAND. (ie return zero). You can trap the screensaver and monitor here too (SC_MONITORPOWER and SC_SCREENSAVE)
cool. But.. I kinda just jumped into Windows programming a few months ago.

Exactly how do i trap the SC_MENU in WM_SYSCOMMAND?

Im not sure how the Message system works.
My guess is the message comes into the WindowProc function, parses into the "switch( message )" statement, looks for a matching message case (i.e. WM_SYSCOMMAND), if it exists it executes the code within that case until it breaks, then it continues on to "DefWindowProc()" at the bottom of the "WindowProc()" function, where the message is reprocessed by the Window handler? Correct?

So to stop the message from reaching the DefWindowProc, you return 0 from the case statement. correct?

So my guess is, in my WM_SYSCOMMAND case, I need to check wParam for the SC_MENU value, and return 0 if it is, correct? .. thats wierd, SC_MENU isnt in VC Help under WM_SYSCOMMAND! eargh.



----------------------
case WM_SYSCOMMAND:

if(wParam == SC_MENU) return(0);

break;
---------------------
Am I correct ..?



  Downloads:  ZeroOne Realm

Sorry. Typo.

SC_KEYMENU

U are correct there.
You might want to check this page :
"INFO: How to Disable ALT+TAB So Single Application Always Has Focus"

http://support.microsoft.com/view/dev.asp?kb=243455

+---------------------------+
| I won't rest until my good| | is better and my better |
| best |
+---Drago-------------------+
osu!

This topic is closed to new replies.

Advertisement