Let the form's title bar does not double click

zhaozj2021-02-16  41

What are you waiting for, let us start now. 1. Create a new VB6 standard EXE project, then add a module to add the following code into a new module:

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 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 constant gwl_wndproc = (-4&)

DIM PrevwndProc &

Const wm_nclbuttondblclk = & ha3 public subinit (hwnd as long) prevwndproc = setwindowlong (hwnd, gwl_wndproc, addressof SubwndProc) end SUB

Public Sub Terminate (HWND As Long) Call SetWindowlong (HWND, GWL_WNDPROC, PrevwndProc) End Sub

Private Function SubWndProc (ByVal hWnd As Long, ByVal Msg As Long, _ ByVal wParam As Long, ByVal lParam As Long) _ As Long If Msg = WM_NCLBUTTONDBLCLK Then Exit Function End If SubWndProc = CallWindowProc (PrevWndProc, hWnd, Msg, wParam, lParam ) End function

2. Add the code in the form of the Load event:

PRIVATE SUB FORM_LOAD () CALL INIT (ME.HWND) End Sub

3. Finally, add: Private Sub Form_UnLoad (Cancel AS Integer)

Call Terminate (me.hwnd)

End Sub

Ok, you can run the project we have created. Now double-click the title bar of the form, is not the same as before!

:)

The above program is compiled by the Win2000 Chinese, VB6.

转载请注明原文地址:https://www.9cbs.com/read-27518.html

New Post(0)