久久―日本道色综合久久,亚洲欧美精品在线,狼狼色丁香久久婷婷综合五月,香蕉人人超,日本网站黄,国产在线观看不卡免费高清,无遮挡的毛片免费

2023信創(chuàng)獨(dú)角獸企業(yè)100強(qiáng)
全世界各行各業(yè)聯(lián)合起來,internet一定要實(shí)現(xiàn)!

VB中拖動沒有標(biāo)題欄的窗體

2004-02-20 eNet&Ciweek

  程序代碼:

Module1
Option Explicit
Public Const GWL_WNDPROC = (-4)

Public Const WM_NCHITTEST = &H84
Public Const HTCLIENT = 1
Public Const HTCAPTION = 2

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
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Public prevWndProc As Long

Function WndProc(ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
WndProc = CallWindowProc(prevWndProc, hWnd, Msg, wParam, lParam)
If Msg = WM_NCHITTEST And WndProc = HTCLIENT Then
WndProc = HTCAPTION
End If
End Function


  程序首先調(diào)用CallWindowProc,這樣就可以從還回值的知當(dāng)前的鼠標(biāo)位置位于那一個區(qū)域,接著判斷返回值是否等于HTCLENT(工作區(qū))內(nèi),如果是,則將返回值設(shè)置成TICAPTION(標(biāo)題區(qū)),這樣就可以瞞過Windows,讓W(xué)indows以為鼠標(biāo)位于標(biāo)題區(qū)內(nèi)

Form1

Option Explicit

Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Form_Load()
prevWndProc = GetWindowLong(Me.hWnd, GWL_WNDPROC)
SetWindowLong Me.hWnd, GWL_WNDPROC, AddressOf WndProc
End Sub

Private Sub Form_Unload(Cancel As Integer)
SetWindowLong Me.hWnd, GWL_WNDPROC, prevWndProc
End Sub

相關(guān)頻道: eNews

您對本文或本站有任何意見,請?jiān)谙路教峤?,謝謝!

投稿信箱:tougao@enet16.com