Re: Background Keystroke Commands...




"cwizzie" <cwizze@xxxxxxxxx> wrote in message
news:1122270511.993947.217570@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> I'm writing a program that staff shouldn't be able to close, but in
> the event that someone from the IT department needs to close the
> program I want them to be able to. If the tech can hit lets say
> "ctrl+0+j" it will bring up a box that says "are you sure you want to
> close? yes/no." Thats what I want to do.
>
>
> Thanks,
>

If your just checking for a few pressed keys then maybe you could use
GetAsyncKeyState

Option Explicit
Private Declare Function GetAsyncKeyState Lib "USER32" (ByVal vKey As Long)
As Integer
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If (GetAsyncKeyState(vbKey0) < 0) And _
(GetAsyncKeyState(vbKeyJ) < 0) And _
(GetAsyncKeyState(vbKeyControl) < 0) Then Unload Me
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Cancel = (MsgBox("You sure", vbYesNo Or vbQuestion, "Confirm Close") =
vbNo)
End Sub


.



Relevant Pages

  • Re: GetAsyncKeyState not working with Right Click
    ... Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As ... Private Sub Timer1_Timer ... Debug.Print "RButton Down" ...
    (microsoft.public.vb.general.discussion)
  • RE: Check boxes selected enters several responses
    ... You might try typing an apostrophe before the DoCmd in the Event procedure ... to track all staff working on a single record in a given day. ... Private Sub List4_AfterUpdate ... reviewing the record and identifying the persons who entered data: ...
    (microsoft.public.access.forms)
  • Re: Preventing a file from being printed?
    ... if the OP's staff are ... Private Sub Workbook_BeforeClose ... 'Use your own sheet name in place of "Sheet 1" ... and the crowning place of kings ...
    (microsoft.public.excel)
  • Re: Forcing a Read Only Filename
    ... Private Sub Workbook_BeforeClose(Cancel As Boolean) ... Dim sht As Worksheet ... MsgBox (" ATTENTION STAFF - MAKE SURE TO PROTECT ALL WORKSHEETS PRIOR ...
    (microsoft.public.excel.misc)
  • Re: Getting Data from Main Form
    ... I would have preferred to have the phone numbers appear as I originally stated, yet I would accept your suggestion. ... Private Sub AltPhone_BeforeUpdate ... The phone fields in Staff table remain blank before, during and after entering the info into other Client table as well as other Staff table fields. ...
    (microsoft.public.access.forms)