You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
Announcement
Collapse
No announcement yet.
Disable PrintScreen key to prevent conventional screendumps?
Disable PrintScreen key to prevent conventional screendumps?
Is this possible? I remember that Netbus can disable keys, so that part is at least possible, but is it possible to block (or remap?) the PrintScreen key as to prevent conventional screendumps?
wooohooo!! that code works perfectly to block the screen dump - very nice
thanks Semen - I searched POFFS but the link was too new (nudge nudge Borje, nudge nudge )
it has also introduced me to the GlobalAddAtom and RegisterHotKey calls... hmm
it doesn't block Alt+PrintScreen though...
Originally posted by Wayne Diamond:
it doesn't block Alt+PrintScreen though...
Wayne --
I don't see this under Win2000.
Code:
#Compile Exe
#Register None
#Dim All
#Include "Win32Api.Inc"
%ID_Text = 201
CallBack Function DlgProc
Dim nAtom(15) As Static Dword, i As Long
Select Case CbMsg
Case %WM_INITDIALOG
For i = 0 To 15
nAtom(i) = GlobalAddAtom ("My Hotkey" + Str$(i) + Str$(Timer))
RegisterHotKey CbHndl, nAtom(i), i, %VK_SNAPSHOT
Next
SetTimer CbHndl, 1, 5000, ByVal 0
Case %WM_DESTROY
For i = 0 To 15
UnregisterHotKey CbHndl, nAtom(i)
GlobalDeleteAtom nAtom(i)
Next
Case %WM_HOTKEY ' CbWparam = nAtom
ShowWindow CbHndl, 1
SetTimer CbHndl, 1, 3000, ByVal 0
Control Set Text CbHndl, %ID_TEXT, "x-PrtSc pressed at " + Time$
Case %WM_TIMER
KillTimer CbHndl, 1: ShowWindow CbHndl, 0
End Select
End Function
Function PbMain
Local hDlg As Long
Dialog New 0, "HotKey (Print Screen)",,, 300, 40, %WS_SYSMENU, _
%WS_EX_TOPMOST Or %WS_EX_TOOLWINDOW To hDlg
Control Add Label, hDlg, %ID_Text, "Press Print Screen in another apps or Close this dialog", _
5, 10, 290, 15, %SS_CENTER
Dialog Show Modal hDlg Call DlgProc
End Function
i was just playing around more with that sample - if you change %VK_SNAPSHOT to %VK_F4 you can block Alt+F4 from killing your program
you rock my world Semen
#Compile Exe
#Register None
#Dim All
#Include "WIN32API.INC"
CallBack Function DlgProc
Select Case CbMsg
Case %WM_SYSCOMMAND: If LoWrd(CbWparam) = %SC_CLOSE Then Function = 1
Case %WM_COMMAND: If CbCtl = %IDOK Then Dialog End CbHndl
End Select
End Function
Function PbMain
Dim hDlg As Long
Dialog New hDlg, "Test", , , 100, 100, %WS_OVERLAPPEDWINDOW Or %WS_CAPTION To hdlg
Control Add Button, hDlg, %IDOK, "End", 10, 10, 80, 15
DeleteMenu GetSystemMenu(hDlg, 0), %SC_CLOSE, %MF_BYCOMMAND ' Not important
Dialog Show Modal hDlg Call DlgProc
End Function
Eric - good point... I forgot that GlobalAtoms were global for a moment
Semen - cute demo! Ive saved that to my samples directory, im sure it will come in very handy soon
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment