Visual Basic > Code Snippets
Move a window
Move a window Private Declare Function MoveWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Sub Command1_Click() Dim rval, x, y, z As Long Form1.AutoRedraw = True x = 5: y = 5 For z = 1 To 50 rval = MoveWindow(Form1.hwnd, x, y, 100, 100, 1) Sleep 100 x = x + 5: y = y + 5 Next z For z = 1 To 50 rval = MoveWindow(Form1.hwnd, x, y, 100, 100, 1) Sleep 100 x = x + 5: y = y - 5 Next z End End Sub
Visual Basic Codes
ActiveX
Miscellaneous
Applications
Code Snippets
Common Dialogs
Special Effects
Database Stuff
Date Time
Files Drives
Forms
Graphics Games
Internet Stuff
Multimedia
Other
Strings
Windows