home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code2 / vb_msg / ncmove.frm < prev    next >
Text File  |  1993-07-19  |  3KB  |  121 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. End
  45. Option Explicit
  46.  
  47. Const WM_CLOSE = &H10
  48.  
  49. Const WM_NCCREATE = &H81
  50. Const WM_NCDESTROY = &H82
  51. Const WM_NCCALCSIZE = &H83
  52. Const WM_NCHITTEST = &H84
  53. Const WM_NCPAINT = &H85
  54. Const WM_NCACTIVATE = &H86
  55. Const WM_GETDLGCODE = &H87
  56. Const WM_NCMOUSEMOVE = &HA0
  57. Const WM_NCLBUTTONDOWN = &HA1
  58. Const WM_NCLBUTTONUP = &HA2
  59. Const WM_NCLBUTTONDBLCLK = &HA3
  60. Const WM_NCRBUTTONDOWN = &HA4
  61. Const WM_NCRBUTTONUP = &HA5
  62. Const WM_NCRBUTTONDBLCLK = &HA6
  63. Const WM_NCMBUTTONDOWN = &HA7
  64. Const WM_NCMBUTTONUP = &HA8
  65. Const WM_NCMBUTTONDBLCLK = &HA9
  66.  
  67. 'WM_NCHITTEST return codes
  68. Const HTERROR = (-2)
  69. Const HTTRANSPARENT = (-1)
  70. Const HTNOWHERE = 0
  71. Const HTCLIENT = 1
  72. Const HTCAPTION = 2
  73. Const HTSYSMENU = 3
  74. Const HTSIZE = 4
  75. Const HTMENU = 5
  76. Const HTHSCROLL = 6
  77. Const HTVSCROLL = 7
  78. Const HTMINBUTTON = 8
  79. Const HTMAXBUTTON = 9
  80. Const HTLEFT = 10
  81. Const HTRIGHT = 11
  82. Const HTTOP = 12
  83. Const HTTOPLEFT = 13
  84. Const HTTOPRIGHT = 14
  85. Const HTBOTTOM = 15
  86. Const HTBOTTOMLEFT = 16
  87. Const HTBOTTOMRIGHT = 17
  88. Const HTBORDER = 18
  89. Const HTGROWBOX = HTSIZE
  90. Const HTREDUCE = HTMINBUTTON
  91. Const HTZOOM = HTMAXBUTTON
  92.  
  93. Sub Form_Load ()
  94.  
  95.     VBMsg1.SubClasshWnd = Form1.hWnd
  96.  
  97. End Sub
  98.  
  99. Sub VBMsg1_WindowMessage (hWindow As Integer, Msg As Integer, wParam As Integer, lParam As Long, RetVal As Long, CallDefProc As Integer)
  100.  
  101.     Select Case Msg
  102.         
  103.         Case WM_NCHITTEST
  104.         
  105.             RetVal = HTCAPTION
  106.             
  107.             CallDefProc = False
  108.         
  109.         Case WM_NCRBUTTONDOWN
  110.         
  111.             VBMsg1.wParam = 0
  112.             VBMsg1.lParam = 0
  113.             VBMsg1.PostMessage = WM_CLOSE
  114.             CallDefProc = False
  115.             Exit Sub
  116.  
  117.     End Select
  118.  
  119. End Sub
  120.  
  121.