Languages :: Delphi :: Disabling Alt+Tab |
|||
| By: dax991 |
Date: 18/12/2005 14:32:40 |
Points: 20 | Status: Answered Quality : Poor |
| How I can disable Alt + Tab combination (this brings up the nice box that shows you the open or minimized windows) in Delphi. | |||
| By: VGR | Date: 18/12/2005 17:07:37 | Type : Answer |
|
| Hello ;-) I first thought "it can't be done unless you use a global system hook, 'cause this is Windows behaviour", but in fact it seems to be easily feasible. I found the answer at this greatis page
var MyW: Word = 0; ... procedure TForm1.Button1Click(Sender: TObject); begin SystemParametersInfo(SPI_SCREENSAVERRUNNING,1,@MyW,0); Label1.Caption:='mode - disable'; end; procedure TForm1.Button2Click(Sender: TObject); begin SystemParametersInfo(SPI_SCREENSAVERRUNNING,0,@MyW,0); Label1.Caption:='mode - enable'; end; So in fact you fool Windows in believing you're a screensaver running, which is in fact a case when Alt-F4 won't work in standard Windows. Hope this helps 8-) |
|||
| By: dax991 | Date: 18/12/2005 19:39:53 | Type : Comment |
|
| I couldn't get that code to work (I manged to assemble the exe file but after that no results) with WinXp Home SP2 and Delphi 7 Enterprise. But I found a wroking bit of code for disabling Alt+F4 combination. //Disable Alt+F4 combination procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); if (Key = VK_F4) and (ssAlt in Shift) then Key := 0; end; I got it somewhere but just now I don't remember where so credits for the original developer of this bit of code. |
|||
| By: VGR | Date: 18/12/2005 19:47:00 | Type : Comment |
|
| nice classical solution to intercept form events. I think this doesn't work in a formless application... (like a console one) don't forget to accept an answer. If you just got clues and not "the" solution, I think the quality to choose is '++' or '+' regards and see you soon |
|||
|
Do register to be able to answer |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








