VB调整窗口大小问题?
怎样让VB窗口的大小不可改变,但标题栏的最小化按钮仍然可用,鼠标移到窗口边缘时也不会变成双向前头,就像QQ的登陆框一样。楼下ourcolour能不能看清除问题了再回答??...
怎样让VB窗口的大小不可改变,但标题栏的最小化按钮仍然可用,鼠标移到窗口边缘时也不会变成双向前头,就像QQ的登陆框一样。
楼下ourcolour能不能看清除问题了再回答?? 展开
楼下ourcolour能不能看清除问题了再回答?? 展开
展开全部
'------------下面是模块代码---------------------------------------
Option Explicit
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Const GWL_WNDPROC = (-4)
Public Const WM_ENDSESSION = &H16
Public Const WM_QUERYENDSESSION = &H11
Public preWinProc As Long
Public Function Wndproc(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Wndproc = CallWindowProc(preWinProc, hwnd, Msg, wParam, lParam)
If (Msg = 132) Then
Select Case Wndproc
Case 10, 11, 12, 13, 14, 15, 16, 17:
Wndproc = 0
Exit Function
End Select
End If
End Function
'------------下面是窗体代码---------------------------------------
Option Explicit
Private Sub Form_Load()
Dim ret As Long
'记录原来的Window Procedure的位址
preWinProc = GetWindowLong(Me.hwnd, GWL_WNDPROC)
'设定form的window Procedure到wndproc
ret = SetWindowLong(Me.hwnd, GWL_WNDPROC, AddressOf Wndproc)
End Sub
Private Sub Form_Unload2(Cancel As Integer)
Dim ret As Long
'取消Message的截取,而使之又只送往原来的Window Procedure
ret = SetWindowLong(Me.hwnd, GWL_WNDPROC, preWinProc)
End Sub
Option Explicit
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Const GWL_WNDPROC = (-4)
Public Const WM_ENDSESSION = &H16
Public Const WM_QUERYENDSESSION = &H11
Public preWinProc As Long
Public Function Wndproc(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Wndproc = CallWindowProc(preWinProc, hwnd, Msg, wParam, lParam)
If (Msg = 132) Then
Select Case Wndproc
Case 10, 11, 12, 13, 14, 15, 16, 17:
Wndproc = 0
Exit Function
End Select
End If
End Function
'------------下面是窗体代码---------------------------------------
Option Explicit
Private Sub Form_Load()
Dim ret As Long
'记录原来的Window Procedure的位址
preWinProc = GetWindowLong(Me.hwnd, GWL_WNDPROC)
'设定form的window Procedure到wndproc
ret = SetWindowLong(Me.hwnd, GWL_WNDPROC, AddressOf Wndproc)
End Sub
Private Sub Form_Unload2(Cancel As Integer)
Dim ret As Long
'取消Message的截取,而使之又只送往原来的Window Procedure
ret = SetWindowLong(Me.hwnd, GWL_WNDPROC, preWinProc)
End Sub
展开全部
设置窗体的FormBorderStyle属性为1-FixedDialog
并且设置窗体的Minbutton属性为True
即可
并且设置窗体的Minbutton属性为True
即可
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
设置borderstlye为3-fixed dialog并且将maxbutton设置为false 将minbutton设置为false.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
.NET
===========
设置FormBorderStyle 为 FixedDialog
如果需要设置MaxmizeBox 为 False
最小化按钮仍然可用 True
===========
设置FormBorderStyle 为 FixedDialog
如果需要设置MaxmizeBox 为 False
最小化按钮仍然可用 True
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询