home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / lock / lock.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-12-05  |  2.9 KB  |  92 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Lock"
  5.    ClientHeight    =   2535
  6.    ClientLeft      =   690
  7.    ClientTop       =   4080
  8.    ClientWidth     =   10335
  9.    ClipControls    =   0   'False
  10.    ControlBox      =   0   'False
  11.    Height          =   2940
  12.    KeyPreview      =   -1  'True
  13.    Left            =   630
  14.    LinkMode        =   1  'Source
  15.    LinkTopic       =   "Form1"
  16.    MaxButton       =   0   'False
  17.    MinButton       =   0   'False
  18.    ScaleHeight     =   2535
  19.    ScaleWidth      =   10335
  20.    Top             =   3735
  21.    Width           =   10455
  22.    Begin TextBox Text1 
  23.       Height          =   1212
  24.       Left            =   2880
  25.       MultiLine       =   -1  'True
  26.       ScrollBars      =   2  'Vertical
  27.       TabIndex        =   1
  28.       Text            =   "text1 has the tabindex 1 and you're able to write in this control."
  29.       Top             =   240
  30.       Width           =   6972
  31.    End
  32.    Begin CommandButton Command1 
  33.       Caption         =   "end"
  34.       Height          =   492
  35.       Left            =   840
  36.       TabIndex        =   0
  37.       Top             =   720
  38.       Width           =   1332
  39.    End
  40.    Begin Label Label1 
  41.       BackColor       =   &H00C0C0C0&
  42.       Caption         =   "this demo shows how to disable task-switching or  termination of an VB -appl. via keyboard. please try  'ctl'  + 'esc' , 'alt' + 'tab' or 'alt' + 'F4'"
  43.       Height          =   492
  44.       Left            =   1320
  45.       TabIndex        =   2
  46.       Top             =   1560
  47.       Width           =   8532
  48.    End
  49. Declare Function getactivewindow Lib "User" () As Integer
  50. Declare Function SetFocusAPI Lib "User" Alias "SetFocus" (ByVal hWnd As Integer) As Integer
  51. Declare Function SetSysModalWindow Lib "User" (ByVal hWnd As Integer) As Integer
  52. Declare Function LockInput Lib "User" (ByVal hReserved As Integer, ByVal hwndInput As Integer, ByVal fLock As Integer) As Integer
  53. Dim vwnd As Integer
  54. ' thomas hengelhaupt
  55. ' comp-serve id 100120,115
  56. Sub Command1_Click ()
  57.       x = LockInput(0, vwnd, 0)
  58.       End
  59. End Sub
  60. Sub Form_KeyDown (keycode As Integer, Shift As Integer)
  61. Select Case keycode
  62.    Case 0 To 20
  63.      keycode = 0
  64.    Case 100 To 255
  65.      keycode = 0
  66. End Select
  67. End Sub
  68. Sub Form_Load ()
  69. DoEvents
  70. vwnd = getactivewindow()
  71. Dim x As Integer
  72. x = SetFocusAPI(vwnd)
  73. x = SetSysModalWindow(vwnd)
  74. x = LockInput(0, vwnd, 1)
  75. End Sub
  76. Sub Form_Unload (Cancel As Integer)
  77. x = LockInput(0, vwnd, 0)
  78. End Sub
  79. Sub List1_Click ()
  80. End Sub
  81. Sub List1_DragOver (Source As Control, x As Single, Y As Single, state As Integer)
  82. End Sub
  83. Sub List1_KeyDown (keycode As Integer, Shift As Integer)
  84. If keycode = 27 Then
  85. Unload form1
  86. Load form1
  87. form1.Show
  88. End If
  89. End Sub
  90. Sub List1_MouseDown (button As Integer, Shift As Integer, x As Single, Y As Single)
  91. End Sub
  92.