VB6 如何得知 (滾輪滑鼠) 按下中間 按鈕 放開 與移動
2006-12-01 15:22:15 · 1 個解答 · 發問者 leecach 2 in 電腦與網際網路 ➔ 程式設計
最後打錯了是滾動不是移動
2006-12-01 15:24:04 · update #1
'版本:VB6.0'******以下寫在模組******Declare Function CallWindowProc& Lib "user32" Alias "CallWindowProcA" (ByVal L&, ByVal H&, ByVal M&, ByVal W&, ByVal P&)Declare Function SetWindowLong& Lib "user32" Alias "SetWindowLongA" (ByVal H&, ByVal I&, ByVal N&)Const WM_MOUSEWHEEL = &H20AConst WM_MBUTTONDOWN = &H207Const WM_MBUTTONUP = &H208Public P&Function WnP&(ByVal H&, ByVal M&, ByVal W&, ByVal L&) If M = WM_MOUSEWHEEL Then '滾動中鍵 If W < 0 Then Form1.Top = Form1.Top + 100 Else Form1.Top = Form1.Top - 100 End If ElseIf M = WM_MBUTTONDOWN Then '按下中鍵 Form1.Print "按下中鍵" ElseIf M = WM_MBUTTONUP Then '放開中鍵 Form1.Print "放開中鍵" Else WnP = CallWindowProc(P, H, M, W, L) End IfEnd Function'******以下寫在表單******Private Sub Form_Load() P = SetWindowLong(Me.hWnd, -4, AddressOf WnP)End SubPrivate Sub Form_Unload(Cancel As Integer) SetWindowLong Me.hWnd, -4, PEnd Sub
2006-12-04 11:43:55 · answer #1 · answered by W.J.S. 7 · 0⤊ 0⤋