home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / scrtst / frmmain.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-01-24  |  2.4 KB  |  85 lines

  1. VERSION 2.00
  2. Begin Form frmMain 
  3.    BackColor       =   &H00000000&
  4.    BorderStyle     =   0  'None
  5.    Caption         =   "Screen Tester"
  6.    ClientHeight    =   7200
  7.    ClientLeft      =   915
  8.    ClientTop       =   2790
  9.    ClientWidth     =   9600
  10.    Height          =   7605
  11.    Icon            =   FRMMAIN.FRX:0000
  12.    KeyPreview      =   -1  'True
  13.    Left            =   855
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    ScaleHeight     =   7200
  17.    ScaleWidth      =   9600
  18.    Top             =   2445
  19.    Width           =   9720
  20. Option Explicit
  21. Sub Form_KeyDown (KeyCode As Integer, Shift As Integer)
  22.   ' Move form around by keyboard -- Exit program on ALT-F4
  23.   Select Case KeyCode
  24.     Case KEY_HOME
  25.       Me.Top = 0
  26.       Me.Left = 0
  27.     Case KEY_LEFT, KEY_UP, KEY_RIGHT, KEY_DOWN
  28.       MoveForm Me
  29.     Case KEY_F4
  30.       If Shift = ALT_MASK Then
  31.         ExitProgram
  32.       End If
  33.     Case Else
  34.       '
  35.       ' Do Nothing
  36.       '
  37.   End Select
  38. End Sub
  39. Sub Form_Load ()
  40.   SetUpForm Me, "Main"
  41. End Sub
  42. Sub Form_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  43.   Dim uPoint As POINTAPI
  44.   Dim uConvert As ConvertPOINTAPI
  45.   Dim r As Integer
  46.   If Button = KEY_LBUTTON Then
  47.     '
  48.     ' Move Window on Left Mouse Down
  49.     '
  50.     ' Further information on this method is available in the following
  51.     ' Microsoft Knowledge Base article.
  52.     '
  53.     '   How to Move a Form that Has No Titlebar or Caption
  54.     '   Article ID: Q114593
  55.     '
  56.     Call GetCursorPos(uPoint)
  57.     LSet uConvert = uPoint
  58.     '
  59.     ' Send LButtonUp to finish the impending LButtonDown.
  60.     ' This line of code will invoke the Form_MouseUp() event,
  61.     ' so be careful what code you place in that event
  62.     '
  63.     r = SendmessageByNum(Me.hWnd, WM_LBUTTONUP, 0, uConvert.xy)
  64.     '
  65.     ' Now tell the form someone is clicking the window caption
  66.     '
  67.     r = SendmessageByNum(Me.hWnd, WM_SYSCOMMAND, MOUSE_MOVE, uConvert.xy)
  68.     '
  69.     ' Save position for .INI file after move is completed
  70.     '
  71.     SaveScreenPosition
  72.   ElseIf Button = KEY_RBUTTON Then
  73.     '
  74.     ' Popup menu on Right Mouse Down
  75.     '
  76.     frmUtility.PopupMenu frmUtility.mnuPopup
  77.   End If
  78. End Sub
  79. Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
  80.   ' Insure clean exit when unload is generated from outside of the program
  81.   If UnloadMode <> 1 Then
  82.     ExitProgram
  83.   End If
  84. End Sub
  85.