Announcement

Collapse
No announcement yet.

Disable PrintScreen key to prevent conventional screendumps?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wayne Diamond
    replied
    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



    ------------------

    Leave a comment:


  • Semen Matusovski
    replied
    I agree with Eric. Correct way is
    Code:
       #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


    ------------------
    E-MAIL: [email protected]

    Leave a comment:


  • Eric Pearson
    replied
    Wayne --

    Be careful that you're not disabling the ability to use Alt-F4 to close any program!

    There are easier/better ways to keep Alt-F4 (and the Close button, double-clicking on the title bar icon, etc.) from closing your programs...

    -- Eric

    ------------------
    Perfect Sync Development Tools
    Perfect Sync Web Site
    Contact Us: mailto:[email protected][email protected]</A>

    Leave a comment:


  • Wayne Diamond
    replied
    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


    ------------------

    Leave a comment:


  • Wayne Diamond
    replied
    PERFECT!!! That now detects PrintScr, Ctrl+PrintScr, Shift+PrintScr and Alt+PrintScr - doesn't get any better than that!
    many thanks again Semen


    ------------------

    Leave a comment:


  • Semen Matusovski
    replied
    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
    ------------------
    E-MAIL: [email protected]

    Leave a comment:


  • Wayne Diamond
    replied
    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...


    ------------------

    Leave a comment:


  • Semen Matusovski
    replied
    wayne -- http://www.powerbasic.com/support/pb...ad.php?t=17624
    in hotkey sample it's necessary to add processing alt-prtsc, ctrl-prtsc, shift-prtsc.
    setclipboardviewer is also could be useful - http://www.powerbasic.com/support/pb...ead.php?t=2786


    ------------------
    e-mail: [email protected]

    Leave a comment:


  • 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?


    ------------------
Working...
X