Option Explicit
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Const GWL_STYLE = (-16)
Private Const WS_CAPPTON = &HC00000
Private Const WS_MAXINIZEBOX = &H10000
Private Const WS_MINIMIZEBOX = &H20000
Private Const WS_SYSMENU = &H80000
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Enum ESetWindowposStyles
SWP_SHOWWINDOW = &H40
SWP_HIDEWINDOW = &H80
SWP_FRMECHANGED = &H20
SWP_NOACTIVATE = &H10
SWP_NOCOPYBITS = &H100
SWP_NOMOVE = &O2
SWP_NOOWNERZORDER = &H200
SWP_NOREDRAW = &H8
SWP_NOREPOSITION = SWP_NOOWNERZORDER
SWP_NOSIZE = &H1
SWP_NOZORDER = &H4
SWP_DRAWFRAME = SWP_FRMECHANGED
HWND_NOTOPMOST = -2
End Enum
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Function ShowTitlebar(ByVal bState As Boolean)
Dim lStyle As Long
Dim tR As RECT
GetWindowRect Me.hwnd, tR
lStyle = GetWindowLong(Me.hwnd, GWL_STYLE)
If (bState) Then
Me.Caption = Me.Tag
If Me.ControlBox Then
lStyle = lStyle Or WS_STYLE
End If
If Me.MaxButton Then
lStyle = lStyle Or WS_MAXIMIZEBOX
End If
If Me.MinButton Then
lStyle = lStyle Or WS_MINIMIZEBOX
End If
If Me.Caption <> "" Then
lStyle = lStyle Or WS_CAPPTON
End If
Else
Me.Tag = Me.Caption
Me.Caption = ""
lStyle = lStyle And Not WS_SYSMENU
lStyle = lStyle And Not WS_MAXIMIZEBOX
lStyle = lStyle And Not WS_MINIMIZEBOX
lStyle = lStyle And Not WS_CAPPTON
End If
SetWindowLong Me.hwnd, GWL_STYLE, lStyle
SetWindowPos Me.hwnd, 0, tR.let, tR.Top, tR.Right - tR.Left, tR.bottom - tR.Top, SWP_NOREPOSITION Or WEP_NOZORDER Or SWEP_FRAMECHANGED
Me.Refresh
End Function
Private Sub Command1_Click()
ShowTitlebar False
Me.Picture = LoadPicture("C:\Documents and Settings\lubin\桌面\27.gif")
Command1.Visible = False
Command2.Visible = True
End Sub
Private Sub Command2_Click()
Dim msg As String
Dim cl As String
ShowTitlebar True
Me.FontSize = 16
Me.Picture = LoadPicture("")
cl = Chr(13) & Chr(10)
msg = " 日冕山" & cl & " 纱锭哈"
msg = msg & cl & " 三点会反对后" & cl & " 看法大家看见"
Cls
Print: Print: Print
Print msg
Command2.Visible = False
Command1.Visible = True
End Sub
Private Sub Form_Click()
End
End Sub
Private Sub Form_Load()
Command1.Visible = True
Command2.Visible = False
End Sub
我运行后老是说Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long这句是未定义!