Page 1 of 2
Posted: Wed Sep 25, 2002 4:54 pm
by BackupUser
Restored from previous forum. Originally posted by merendo.
Hi everybody and nobody,
I want an app to forbid the user to do anything outside the app (terminating the app by Ctrl+Alt+Del, switching to/running another app, shut down windows, use the windows taskbar, shortkeys and so on...). The app shall be closeable only with a password. Are my dreams to big or is possible what I want?
Cu @ll, merendo
--
I've been hiding - What am I hiding from???
Posted: Wed Sep 25, 2002 5:05 pm
by BackupUser
Restored from previous forum. Originally posted by Danilo.
Sounds like a screensaver...
cya,
...Danilo
(registered PureBasic user)
Posted: Wed Sep 25, 2002 5:29 pm
by BackupUser
Restored from previous forum. Originally posted by merendo.
No way. Well, It sounds like one, but it isnt a scrensaver. Its a mediaplayer, which i am planning to use at partys. When most people are already drunk and do only mess and stupid things. And I don't want them to mess the sound or the computer. So only people, who have the password may do changes. (Well, it's going to be a problem if even all people, who know the password are already drunk and not able to remember the password

)
Cu @ll, merendo
--
I've been hiding - What am I hiding from???
Posted: Wed Sep 25, 2002 5:44 pm
by BackupUser
Restored from previous forum. Originally posted by Danilo.
A screensaver is only a exe.
Write a program, rename .EXE to .SCR
and make a fullscreen window in this app.
the app exits after password is right.
sounds easy..
..and the tasksitch things should be
handled by windows, so only your app
can be active.
cya,
...Danilo
(registered PureBasic user)
Posted: Wed Sep 25, 2002 6:03 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
> I want an app to forbid the user to do anything outside the app
> (terminating the app by Ctrl+Alt+Del, switching to/running another
> app [snip]
What Operating System is it to be used on? Because you can only disable
CTRL+ALT+DEL on Win 95, 98 and ME. However, if I was to do this, I'd
make the player full-screen, on-top, and watch for when it loses the
focus. Once focus is lost, close the new app and give the focus back
to your app immediately. This will stop the user using the taskbar,
start key, etc.
Here's a crude example of retaining the focus. There are better ways,
but I'm at work and don't have the proper documentation to find the
correct Windows messages and so on. Besides, for drunk party people
it should work fine.
Code: Select all
dtw=GetSystemMetrics_(#SM_CXSCREEN) ; Desktop width.
dth=GetSystemMetrics_(#SM_CYSCREEN) ; Desktop height.
;
If OpenWindow(0,0,0,dtw,dth,#PB_Window_SystemMenu,"Always in use")
Repeat
Sleep_(1) : ev=WindowEvent()
If GetForegroundWindow_()WindowID()
SetForegroundWindow_(WindowID())
EndIf
Until ev=#PB_Event_CloseWindow
EndIf
PB - Registered PureBasic Coder
Posted: Wed Sep 25, 2002 8:30 pm
by BackupUser
Restored from previous forum. Originally posted by chr1sb.
Unplug the mouse and keyboard and hide them away:)
chr1sb
Posted: Wed Sep 25, 2002 8:38 pm
by BackupUser
Restored from previous forum. Originally posted by Berikco.
Originally posted by chr1sb
Unplug the mouse and keyboard and hide them away:)
Whe always hide the mouse and keyboard on exhibition, and put another one - not connected - for the pc, and than put a webcam to see al the 'hackers' try to get in

Works fine.
Regards,
Berikco
http://www.benny.zeb.be
Posted: Thu Sep 26, 2002 2:14 am
by BackupUser
Restored from previous forum. Originally posted by Danilo.
merendo,
on winNT/2000/XP no program is allowed to
block the CTRL+ALT+DEL, because this would
be a security risc.
Every program could block CTRL+ALT+DEL and
do what it wants... and the user couldnt stop
it anymore.
If you use Windows98, you can do it by telling
windows your app is a screensaver.
This code disables ALT+TAB, ATL+ESC, and Windows-Keys...
...also on Win2000:
Code: Select all
SystemParametersInfo_( #SPI_SCREENSAVERRUNNING, 1, @Dummy, 0);
OpenLibrary(1,"kernel32.dll")
CallFunction(1,"RegisterServiceProcess", GetCurrentProcessID_(), 1 )
Structure KBDLLHOOKSTRUCT
vkCode.l
scanCode.l
flags.l
time.l
dwExtraInfo.l
EndStructure
Procedure.l myKeyboardHook(nCode, wParam, *p.KBDLLHOOKSTRUCT)
If nCode = #HC_ACTION
If wParam = #WM_KEYDOWN Or wParam = #WM_SYSKEYDOWN Or wParam = #WM_KEYUP Or wParam = #WM_SYSKEYUP
#LLKHF_ALTDOWN = $20
If ((*p\vkCode = #VK_TAB) And (*p\flags & #LLKHF_ALTDOWN)) Or ((*p\vkCode = #VK_ESCAPE) And (*p\flags & #LLKHF_ALTDOWN)) Or ((*p\vkCode & #VK_ESCAPE) And (GetKeyState_(#VK_CONTROL) & $8000)) ;Or
ProcedureReturn 1
ElseIf (*p\vkCode = #VK_LWIN) Or (*p\vkCode = #VK_RWIN)
ProcedureReturn 1
EndIf
EndIf
EndIf
;beep_(800,1)
ProcedureReturn CallNextHookEx_(0, nCode, wParam, lParam)
EndProcedure
; Win NT
#WH_KEYBOARD_LL = 13
hook = SetWindowsHookEx_(#WH_KEYBOARD_LL,@myKeyboardHook(),GetModuleHandle_(0),0)
;If hook = 0: End: EndIf
hWnd = OpenWindow(1,10,10,100,100,#PB_Window_BorderLess,"")
ShowWindow_(hWnd, #SW_MAXIMIZE)
SetWinBackgroundColor(hWnd,0)
CreateGadgetList(hWnd)
hString = StringGadget(1,GetSystemMetrics_(#SM_CXSCREEN)/2-100/2, GetSystemMetrics_(#SM_CYSCREEN)/2,100,20,"Enter Password",#PB_String_Numeric)
SetFocus_(hString)
GetWindowRect_(hString, winrect.RECT)
;SetThreadPriority_(GetCurrentThread_(),#REALTIME_PRIORITY_CLASS)
Repeat
Message = WindowEvent()
SetActiveWindow_(hWnd)
SetWindowPos_(hWnd,#HWND_TOPMOST,0,0,0,0,#SWP_NOMOVE|#SWP_NOSIZE)
ClipCursor_(winrect)
SendMessage_(hstring,#WM_KEYDOWN,#VK_END,0)
SetFocus_(hString)
If Message
Select Message
Case #PB_EventGadget
Select EventGadgetID()
Case 1
If GetGadgetText(1) = "123"
UnhookWindowsHookEx_(hook)
ClipCursor_(0)
SystemParametersInfo_( #SPI_SCREENSAVERRUNNING, 0, @Dummy, 0);
End
EndIf
EndSelect
EndSelect
Else
Delay(1)
EndIf
ForEver
But CTRL+ALT+DEL can on win2000 only be disabled
by writing a lowlevel system device driver for the keyboard.
Info about this should be in the MS DDK.
Best way for you would be to install win98
on your disco machine...
cya,
...Danilo
(registered PureBasic user)
Posted: Thu Sep 26, 2002 11:18 am
by BackupUser
Restored from previous forum. Originally posted by merendo.
I'm planning to install Win98 on my party sound machine. (It is not a disco machine. A party is different than a disco: On a party, people just get drunk and smoke something illegal

. On a disco, people only take XTC-pills and nothing sensefull!)
@Chris: And what to do, if I want to play another song???
Well, I am trying danilos method, renaming the exe to scr. If it doesn't work, I am going to try your solution. PB.
Thanks @ll for answering so fast, thank you very much!
Cu @ll, merendo
--
I've been hiding - What am I hiding from???
Posted: Thu Sep 26, 2002 2:19 pm
by BackupUser
Restored from previous forum. Originally posted by Danilo.
merendo, see my source above.
The line " SystemParametersInfo_( #SPI_SCREENSAVERRUNNING, 1, @Dummy, 0) "
is for Windows 9x Systems.
It tells Windows that a screensaver is running, so it blocks
all other input on Win9x.
cya,
...Danilo
(registered PureBasic user)
Posted: Thu Sep 26, 2002 5:45 pm
by BackupUser
Restored from previous forum. Originally posted by chr1sb.
Originally posted by merendo
@Chris: And what to do, if I want to play another song???
You plug them back in! Or just the mouse - carry around one of those baby mice that you get for laptops - make sure your program doesn't need keyboard and have it start automatically when windows loads because no matter how clever your code a drunk person might just reboot the machine (and maybe start displaying your private jpeg collection on the big projection screen even though your program used the #SPI_SCREENSAVERRUNNING method - Found this out the hard way)
chr1sb
Posted: Thu Sep 26, 2002 6:02 pm
by BackupUser
Restored from previous forum. Originally posted by merendo.
Well, I could write an exe for dos and set the autoexec.bat to execute it. If the password is wrong then: No way. You are not allowed to work on this chest. Booting canceled. Otherwise say the passwort is correct. And If the drunk people try to restart my machine, I will hit them.
Cu @ll, merendo
--
I've been hiding - What am I hiding from???
Posted: Fri Sep 27, 2002 4:37 am
by BackupUser
Restored from previous forum. Originally posted by Danilo.
Just modify the PC, so it doesnt have an RESET and ON/OFF switch.
This can be separate and only if you plug in the RESET-ON/OFF switch cable
it can be done...
cya,
...Danilo
(registered PureBasic user)
Posted: Fri Sep 27, 2002 12:39 pm
by BackupUser
Restored from previous forum. Originally posted by merendo.
Well, but If i inplug the ON/OFF switch, I am also not able to switch my chest off.
Ganz nach dem Motto: Den totalen Schutz gibt es nicht!
Cu @ll, merendo
--
I've been hiding - What am I hiding from???
Posted: Fri Sep 27, 2002 7:35 pm
by BackupUser
Restored from previous forum. Originally posted by Berikco.
Put you're PC in another room, lock the room.
Use a wireless transmitter for the screen.
Use a wireless keyboard and mouse.
Don't loose the key
Regards,
Berikco
http://www.benny.zeb.be