VB and VBA Users Source Code: Changing the way a form is repainted while being resized/dragged
[
Home
|
Contents
|
Search
|
Reply
| Previous | Next ]
VB/VBA Source Code
Changing the way a form is repainted while being resized/dragged
By:
Andrew Baker
Email (spam proof):
Email the originator of this post
Date:
Thursday, May 31, 2001
Hits:
610
Category:
Windows API
Article:
The following code changes the way in which Windows handles the screen updating for dragging and resizing of forms: Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long 'Purpose : Determines if full window drag is enabled (i.e. when dragging a window does ' the screen show an outline of the window or the window itself). 'Inputs : N/A 'Outputs : Returns True if full window drag is enabled. 'Author : Andrew Baker 'Date : 25/04/2001 'Notes : Affects dragging/resize of all windows on this machine Function WindowDragFullOn() As Boolean Const SPI_GETDRAGFULLWINDOWS = 38 Dim lRetVal As Long If CBool(SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0&, lRetVal, 0&)) Then 'Feature supported If lRetVal = 0 Then 'Feature disabled WindowDragFullOn = False Else 'Feature enabled WindowDragFullOn = True End If Else 'Feature not supported. WindowDragFullOn = False End If End Function 'Purpose : Enables/disables the full window drag 'Inputs : Enabled If True enables full window dragging. 'Outputs : Returns True if successfully set value. 'Author : Andrew Baker 'Date : 25/04/2001 'Notes : Affects all windows on this machine Function WindowDragFull(Enabled As Boolean) As Boolean Const SPI_SETDRAGFULLWINDOWS = 37 Const SPIF_SENDWININICHANGE = 2 If Enabled Then 'Enable full window drag. WindowDragFull = SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, 1&, ByVal vbNullString, SPIF_SENDWININICHANGE) Else 'Disable full window drag. WindowDragFull = SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, 0&, ByVal vbNullString, SPIF_SENDWININICHANGE) End If End Function 'Demonstration routine 'Swaps the state of the full window dragging Sub Test() If WindowDragFullOn Then WindowDragFull False Else WindowDragFull True End If End Sub
Terms and Conditions
Support this site
Download a trial version of the Excel Workbook Rebuilder