PDA

View Full Version : How to prevent game from switching to windows desktop???



p(3.14)
09-04-2007, 04:17 PM
Hi, I have made a game wich runs in full screen and uses the mouse, however when the user points the mouse to the bottom of the screen (where the taskbar usually is) and presses mouse button the game is minimized.I have flip enabled and align all client in DXDraw, but still no efect.How can I prevent the game from switching to desktop?I have seen it done in several UndelphiX Demos, but all thoe I looked at the code I can't figure out how they didi it.

Traveler
09-04-2007, 06:55 PM
It's a setting in the dxdraw component. Check the properties for the fullscreen option.

I´m curious though, you say you have fullscreen, how exactly did you realize that?

seiferalmasy
09-04-2007, 06:57 PM
Trav is right. Go into a sprite demo and look at the code under the fullscreen option on the menu bar.

p(3.14)
09-04-2007, 08:36 PM
I forgot to mention I allready have doFullscreen set to true, that is how I know it is full screen.The problem occurs when the user clicks
with the mouse where the windows task bar is (its invisible actualy because DXDraw draws over it) wich results in minimizeing the game and switching the focus to the desktop.So my question actualy is how can I prevent the game from minimizing and looseing the focus?

P.P.
Sorry if my question was unclear or for any spelling and grammar mistakes,but English is not my native language.

JernejL
10-04-2007, 07:57 AM
However you are going to fix it, never do it by preventing user to alt+tab out of the game, if anything pisses me off more is this.

Traveler
10-04-2007, 08:04 AM
That's odd, I've never had that problem before.

I think the best option is to search for the difference between your game and the demo's.
You could also try and upload you game somewhere so we can have a look at it. Maybe it's related to your machine.

p(3.14)
10-04-2007, 11:52 AM
Thanks for trying to help guys, I think I found what is causing this.I am using
Mouse.CursorPos... which seems to be a global variable (i dont use DXInput, it stops working sometimes ),now I have to figure out how to fix it :) .I could upload my game somewhere ,but its rather big (>30mb) and the source code is more than 4000 lines ,so I dont want to boder you wich such things :D

seiferalmasy
10-04-2007, 04:23 PM
However you are going to fix it, never do it by preventing user to alt+tab out of the game, if anything pisses me off more is this.

I agree

savage
10-04-2007, 04:26 PM
Thanks for trying to help guys, I think I found what is causing this.I am using
Mouse.CursorPos... which seems to be a global variable (i dont use DXInput, it stops working sometimes ),now I have to figure out how to fix it :) .I could upload my game somewhere ,but its rather big (>30mb) and the source code is more than 4000 lines ,so I dont want to boder you wich such things :D

In what situations have you found DXInput to stop working?

p(3.14)
10-04-2007, 07:23 PM
Well, I compile the game and it runs ok, the next day I run delphi,load my game project, but when i try to run it i get a message FDInput ... cant pass parameter or something (sry cant quote,but when it happens again I'll tell you what the exact error is) and it switchs to DXInput.pas showing some line where the error is.However, when i overwrite the dxinput files it works fine for some time and then it happens again.Btw, I solved my problem,had to set DXDraw align property to align custom ,because if it is set to align all it excludes the taskbar from the client area for some reason.

Clootie
11-04-2007, 07:15 PM
p(3.14)
1) Probably you have not set correct flags for window you are using as a backgound to your DX fullscreen surface (so your maximized window still do not cover taskbar). IIRC it sould be something like WS_POPUP and without borders.

2) It's not recommended to use DirectInput for mouse and keyboard polling under WinXP and later. This is due to DiretInput is emulated on these OSes, so use standard windows input functions for this. DInput should be used only for special controllers (for example force feedback is only supported in DInput).

p(3.14)
17-04-2007, 12:36 PM
Thanks ,Clootie, I'll keep your advice in mind.