Public Temp$, Title$, xx%, yy%, t%, ff%, CLnum%, CatIdx%
Public SelCode$, AppendIdx%, ReplaceIdx%
Public Declare Function SendMessageAsLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'Declarations for ExplodeForm
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long 'note error in declare
Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Declare Function MoveWindow Lib "user32" (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
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Const WM_RBUTTONDOWN = &H204
Public Sub SizeCombo(frm As Form, cbo As ComboBox)
Dim cbo_left As Integer
Dim cbo_top As Integer
Dim cbo_width As Integer
Dim cbo_height As Integer
Dim old_scale_mode As Integer
' Change the Scale Mode on the form to Pixels.
old_scale_mode = frm.ScaleMode
frm.ScaleMode = vbPixels
' Save the ComboBox's Left, Top, and Width values.
Sub ExplodeForm(frm As Form, Steps As Long, Color As Long)
Dim ThisRect As RECT, RectWidth As Integer, RectHeight As Integer, ScreenDevice As Long, NewBrush As Long, OldBrush As Long, I As Long, X As Integer, Y As Integer, XRect As Integer, YRect As Integer
If Steps < 20 Then Steps = 20
'Zooming speed will be different based on machine speed!
If Color = 0 Then
Color = frm.BackColor
End If
Steps = Steps * 10
'Get current form window dimensions
GetWindowRect frm.hwnd, ThisRect
RectWidth = (ThisRect.Right - ThisRect.Left)
RectHeight = ThisRect.Bottom - ThisRect.Top
'Get a device handle for the screen
ScreenDevice = GetDC(0)
'Create a brush for drawing to the screen
'and save the old brush
NewBrush = CreateSolidBrush(Color)
OldBrush = SelectObject(ScreenDevice, NewBrush)
For I = 1 To Steps
XRect = RectWidth * (I / Steps)
YRect = RectHeight * (I / Steps)
X = ThisRect.Left + (RectWidth - XRect) / 2
Y = ThisRect.Top + (RectHeight - YRect) / 2
'Incrementally draw rectangle
Rectangle ScreenDevice, X, Y, X + XRect, Y + YRect
Next I
'Return old brush and delete screen device context handle