home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / CODIGO_2 / VB_MSG / NCMOVE.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1993-07-19  |  3.2 KB  |  109 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BorderStyle     =   3  'Fixed Double
  4.    ClientHeight    =   3435
  5.    ClientLeft      =   2115
  6.    ClientTop       =   2310
  7.    ClientWidth     =   6420
  8.    ControlBox      =   0   'False
  9.    Height          =   3840
  10.    Left            =   2055
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   3435
  15.    ScaleWidth      =   6420
  16.    Top             =   1965
  17.    Width           =   6540
  18.    Begin VBMsg VBMsg1 
  19.       Height          =   420
  20.       Left            =   5880
  21.       MessageCount    =   NCMOVE.FRX:0000
  22.       MessageList     =   NCMOVE.FRX:0002
  23.       MessageTypes    =   0  'Selected Messages
  24.       PostDefault     =   0   'False
  25.       Top             =   2910
  26.       Width           =   420
  27.    End
  28.    Begin Label Label2 
  29.       Caption         =   "This sample shows how you can have a caption-less window and still be able to move it with the left mouse button.  This sample traps the WM_NCHITTEST message to perform this function."
  30.       Height          =   885
  31.       Left            =   870
  32.       TabIndex        =   1
  33.       Top             =   480
  34.       Width           =   4755
  35.    End
  36.    Begin Label Label1 
  37.       Caption         =   "Use the left mouse button anywhere on this form to drag the window.  Click once on the right mouse button anywhere on the form to close this window."
  38.       Height          =   705
  39.       Left            =   870
  40.       TabIndex        =   0
  41.       Top             =   1830
  42.       Width           =   4755
  43.    End
  44. Option Explicit
  45. Const WM_CLOSE = &H10
  46. Const WM_NCCREATE = &H81
  47. Const WM_NCDESTROY = &H82
  48. Const WM_NCCALCSIZE = &H83
  49. Const WM_NCHITTEST = &H84
  50. Const WM_NCPAINT = &H85
  51. Const WM_NCACTIVATE = &H86
  52. Const WM_GETDLGCODE = &H87
  53. Const WM_NCMOUSEMOVE = &HA0
  54. Const WM_NCLBUTTONDOWN = &HA1
  55. Const WM_NCLBUTTONUP = &HA2
  56. Const WM_NCLBUTTONDBLCLK = &HA3
  57. Const WM_NCRBUTTONDOWN = &HA4
  58. Const WM_NCRBUTTONUP = &HA5
  59. Const WM_NCRBUTTONDBLCLK = &HA6
  60. Const WM_NCMBUTTONDOWN = &HA7
  61. Const WM_NCMBUTTONUP = &HA8
  62. Const WM_NCMBUTTONDBLCLK = &HA9
  63. 'WM_NCHITTEST return codes
  64. Const HTERROR = (-2)
  65. Const HTTRANSPARENT = (-1)
  66. Const HTNOWHERE = 0
  67. Const HTCLIENT = 1
  68. Const HTCAPTION = 2
  69. Const HTSYSMENU = 3
  70. Const HTSIZE = 4
  71. Const HTMENU = 5
  72. Const HTHSCROLL = 6
  73. Const HTVSCROLL = 7
  74. Const HTMINBUTTON = 8
  75. Const HTMAXBUTTON = 9
  76. Const HTLEFT = 10
  77. Const HTRIGHT = 11
  78. Const HTTOP = 12
  79. Const HTTOPLEFT = 13
  80. Const HTTOPRIGHT = 14
  81. Const HTBOTTOM = 15
  82. Const HTBOTTOMLEFT = 16
  83. Const HTBOTTOMRIGHT = 17
  84. Const HTBORDER = 18
  85. Const HTGROWBOX = HTSIZE
  86. Const HTREDUCE = HTMINBUTTON
  87. Const HTZOOM = HTMAXBUTTON
  88. Sub Form_Load ()
  89.     VBMsg1.SubClasshWnd = Form1.hWnd
  90. End Sub
  91. Sub VBMsg1_WindowMessage (hWindow As Integer, Msg As Integer, wParam As Integer, lParam As Long, RetVal As Long, CallDefProc As Integer)
  92.     Select Case Msg
  93.         
  94.         Case WM_NCHITTEST
  95.         
  96.             RetVal = HTCAPTION
  97.             
  98.             CallDefProc = False
  99.         
  100.         Case WM_NCRBUTTONDOWN
  101.         
  102.             VBMsg1.wParam = 0
  103.             VBMsg1.lParam = 0
  104.             VBMsg1.PostMessage = WM_CLOSE
  105.             CallDefProc = False
  106.             Exit Sub
  107.     End Select
  108. End Sub
  109.