Original Post
🔒 Locked
managing alt+tab
Advertisement
Alt-Tab should not be disabled, unless you are building a kiosk or something specialized. Your textures that are loaded should be stored in system memory so when a alt-tab occurs you can easily load them back into video memory when your program gains focus, among other things.
-----------------
Check out CodeBASIC.org
-----------------
Check out CodeBASIC.org
Don't disable alt-tab. In an NT environment like XP, if you do it incorrectly, you can end up not being able to log into windows anymore. There are many numbers of ways you can prevent alt-tab from working, but I say it again: -Don't do it! It almost invariably leads to troubles. Besides, there other reasons why an application might loose focus. Ex: AV software, Updating softwares, or other software that may demand focus for any other of reasons. To put it plainly, you need to deal with your application loosing focus. There simply is no way around it.
There are games that disable ALT+TAB. I dont think this is nice but I dont think this is so dangerous as you say.
I used it on XP and Win98 without problem.
Obviously YOU MUST PROVIDE AN EXIT FROM YOUR PROGRAM.
If something goes wrong you have to hardware reset your computer!
This is the code you need: it is not a black art secret but it is well documented.
The idea is simply to disable all windows except the window you are using
this disables SCREENSAVERS, ALT+TAB and CTRL+ALT+DEL
Usage: pass your window and the state requested (true or false)
NOTE: remember to pass false to disable the exclusive mode when exit!!!
unless you want to turn off your computer [smile]
this is the callback function
Two suggestions: 1) rate me 2) dont send me a copy or your program [lol]
I used it on XP and Win98 without problem.
Obviously YOU MUST PROVIDE AN EXIT FROM YOUR PROGRAM.
If something goes wrong you have to hardware reset your computer!
This is the code you need: it is not a black art secret but it is well documented.
The idea is simply to disable all windows except the window you are using
this disables SCREENSAVERS, ALT+TAB and CTRL+ALT+DEL
Usage: pass your window and the state requested (true or false)
NOTE: remember to pass false to disable the exclusive mode when exit!!!
unless you want to turn off your computer [smile]
bool SetExclusiveMode(HWND hwnd, bool bExclusiveMode){ bool oldState; DLONG dlong; bool bEnableWindows = (!bExclusiveMode); bool bSetScreenSaveActive = ( bExclusiveMode); dlong.wParam = (WPARAM)(hwnd); // your window dlong.lParam = (LPARAM)(bEnableWindows); // state requested for the others LONG enumParam = (LONG)(&dlong); WNDENUMPROC EnumWindowsProc = (WNDENUMPROC)EnumWindowsProc_enb; EnumWindows(EnumWindowsProc, enumParam); // callback function SystemParametersInfo(SPI_SCREENSAVERRUNNING, bSetScreenSaveActive, &oldState, 0); return true;}this is the callback function
BOOL CALLBACK EnumWindowsProc_enb(HWND hwnd, LPARAM lParam){ DLONG dlong = *((DLONG*) lParam); HWND MainWnd = (HWND)dlong.wParam; // the window you are using BOOL bEnable = dlong.lParam; // state requested if( (hwnd != MainWnd) && (IsWindowEnabled(hwnd)!=bEnable)) EnableWindow(hwnd, bEnable); return TRUE;}Two suggestions: 1) rate me 2) dont send me a copy or your program [lol]
Someting is wrong i get errors compiling like this
D:\projects\Unrevealed\Main.cpp(9) : error C2065: 'DLONG' : undeclared identifier
D:\projects\Unrevealed\Main.cpp(9) : error C2146: syntax error : missing ';' before identifier 'dlong'
D:\projects\Unrevealed\Main.cpp(9) : error C2065: 'dlong' : undeclared identifier
D:\projects\Unrevealed\Main.cpp(9) : error C2059: syntax error : ')'
D:\projects\Unrevealed\Main.cpp(10) : error C2228: left of '.wParam' must have class/struct/union type
D:\projects\Unrevealed\Main.cpp(11) : error C2228: left of '.lParam' must have class/struct/union type
D:\projects\Unrevealed\Main.cpp(20) : error C2146: syntax error : missing ';' before identifier 'dlong'
D:\projects\Unrevealed\Main.cpp(24) : error C2228: left of '.wParam' must have class/struct/union type
D:\projects\Unrevealed\Main.cpp(25) : error C2228: left of '.lParam' must have class/struct/union type
Base.cpp
c:\dxsdk\include\dinput.h: DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800
d:\projects\unrevealed\base.h(22) : warning C4081: expected 'newline'; found ';'
d:\projects\unrevealed\base.h(23) : warning C4081: expected 'newline'; found ';'
d:\projects\unrevealed\base.h(24) : warning C4081: expected 'newline'; found ';'
Game.cpp
c:\dxsdk\include\dinput.h: DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800
d:\projects\unrevealed\base.h(22) : warning C4081: expected 'newline'; found ';'
d:\projects\unrevealed\base.h(23) : warning C4081: expected 'newline'; found ';'
d:\projects\unrevealed\base.h(24) : warning C4081: expected 'newline'; found ';'
Error executing cl.exe.
*******.exe - 9 error(s), 9 warning(s)
D:\projects\Unrevealed\Main.cpp(9) : error C2065: 'DLONG' : undeclared identifier
D:\projects\Unrevealed\Main.cpp(9) : error C2146: syntax error : missing ';' before identifier 'dlong'
D:\projects\Unrevealed\Main.cpp(9) : error C2065: 'dlong' : undeclared identifier
D:\projects\Unrevealed\Main.cpp(9) : error C2059: syntax error : ')'
D:\projects\Unrevealed\Main.cpp(10) : error C2228: left of '.wParam' must have class/struct/union type
D:\projects\Unrevealed\Main.cpp(11) : error C2228: left of '.lParam' must have class/struct/union type
D:\projects\Unrevealed\Main.cpp(20) : error C2146: syntax error : missing ';' before identifier 'dlong'
D:\projects\Unrevealed\Main.cpp(24) : error C2228: left of '.wParam' must have class/struct/union type
D:\projects\Unrevealed\Main.cpp(25) : error C2228: left of '.lParam' must have class/struct/union type
Base.cpp
c:\dxsdk\include\dinput.h: DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800
d:\projects\unrevealed\base.h(22) : warning C4081: expected 'newline'; found ';'
d:\projects\unrevealed\base.h(23) : warning C4081: expected 'newline'; found ';'
d:\projects\unrevealed\base.h(24) : warning C4081: expected 'newline'; found ';'
Game.cpp
c:\dxsdk\include\dinput.h: DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800
d:\projects\unrevealed\base.h(22) : warning C4081: expected 'newline'; found ';'
d:\projects\unrevealed\base.h(23) : warning C4081: expected 'newline'; found ';'
d:\projects\unrevealed\base.h(24) : warning C4081: expected 'newline'; found ';'
Error executing cl.exe.
*******.exe - 9 error(s), 9 warning(s)
Always start to look at the first error to solve it:
This is pretty easy, looking through the code we see DLONG is used as a type. I dont know what blizzard intended DLONG to be, but I think should do something like this:
Of course you would have to replace type with whatever it should be.
Quote:
Original post by Raxvan
D:\projects\Unrevealed\Main.cpp(9) : error C2065: 'DLONG' : undeclared identifier
This is pretty easy, looking through the code we see DLONG is used as a type. I dont know what blizzard intended DLONG to be, but I think should do something like this:
typedef type DLONG;// Or this:// #define DLONG typeOf course you would have to replace type with whatever it should be.
Sorry! I copied the code from my file and I've not noticed that DLONG is not in the 'hungarian' winsows typedef!!!
Here
it's simply a long pair
For your direct input errors I dont know [smile]
Here
typedef struct _DLONG{ LONG wParam; LONG lParam;} DLONG;it's simply a long pair
For your direct input errors I dont know [smile]
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement