Form Events and Capabilities VB6: Difference between revisions

From Free Knowledge Base- The DUCK Project
Jump to navigation Jump to search
New page: <nowiki>Option Explicit</nowiki> <nowiki></nowiki> <nowiki>Dim WithEvents vbLink As EventVB.APIFunctions</nowiki> <nowiki>Dim WithEvents vbWnd As EventVB.ApiWindow</nowiki> <nowi...
 
mNo edit summary
Line 1: Line 1:
First add the EventVB.dll to your project references.  It is not included with Visual Studio.  Microsoft VB .NET has a form_move event, but Visual BASIC 6 does not.
   <nowiki>Option Explicit</nowiki>
   <nowiki>Option Explicit</nowiki>
   <nowiki></nowiki>
   <nowiki></nowiki>

Revision as of 16:19, 20 September 2007

First add the EventVB.dll to your project references. It is not included with Visual Studio. Microsoft VB .NET has a form_move event, but Visual BASIC 6 does not.

 Option Explicit
 
 Dim WithEvents vbLink As EventVB.APIFunctions
 Dim WithEvents vbWnd As EventVB.ApiWindow
 
 Private Sub Form_Load()
 
 Set vbLink = New APIFunctions
 
 Set vbWnd = New ApiWindow
 vbWnd.hWnd = Me.hWnd
 '\\ Subclass this form
 vbLink.SubclassedWindows.Add vbWnd
 
 End Sub
 
 Private Sub vbWnd_Move(ByVal x As Long, ByVal y As Long, Cancel As Boolean)
 
 '\\ This event occurs when a drag-move completes:
 Debug.Print "Moved to " & x & "," & y
 
 End Sub
 
 Private Sub vbWnd_Moving(ByVal MoveEdges As EventVB.WindowSizingEdges, MoveRectangle As EventVB.APIRect)
 
 '\\ This event occurs during the drag-move
 With MoveRectangle
     Debug.Print "Moving to " & .Left & "," & .Top & " - " & .Right & "," & .Bottom
 End With
 
 End Sub