| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 369 人关注过本帖
标题:求助!
只看楼主 加入收藏
shaoairong
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2008-4-23
收藏
 问题点数:0 回复次数:0 
求助!
Option Explicit

Type POINTAPI
        x As Long
        y As Long
End Type

Type MINMAXINFO
        ptReserved As POINTAPI
        ptMaxSize As POINTAPI
        ptMaxPosition As POINTAPI
        ptMinTrackSize As POINTAPI
        ptMaxTrackSize As POINTAPI
End Type

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 SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDest As Any, pSource As Any, ByVal ByteLen As Long)

Public Const GWL_WNDPROC = (-4)
Public Const WM_GETMINMAXINFO = &H24

Dim OldProc&
Dim mhWnd&

'==================================================
'回调
Function WinProc&(ByVal hWnd&, ByVal wMsg&, _
                  ByVal wParam&, ByVal lParam&)
                  
    Select Case wMsg&
        Case WM_GETMINMAXINFO
            Dim MinMax As MINMAXINFO
            
            CopyMemory MinMax, ByVal lParam, Len(MinMax)
            
            MinMax.ptMinTrackSize.x = 640
            MinMax.ptMinTrackSize.y = 550
         '   MinMax.ptMaxTrackSize.x = 808
        '    MinMax.ptMaxTrackSize.y = 150
            
            CopyMemory ByVal lParam, MinMax, Len(MinMax)
            
            WinProc& = 1
            Exit Function
    End Select
   
    WinProc& = CallWindowProc(OldProc, hWnd, wMsg, wParam, lParam)
End Function
'==================================================


'==================================================
'挂钩
Sub Hook(ByVal nhWnd&)

    If OldProc <> 0 Then Exit Sub
   
    mhWnd& = nhWnd&
   
    OldProc = SetWindowLong(nhWnd&, GWL_WNDPROC, AddressOf WinProc)

End Sub
'==================================================


'==================================================
'脱钩
Sub UnHook()

    If OldProc = 0 Then Exit Sub

    SetWindowLong mhWnd, GWL_WNDPROC, OldProc
    OldProc = 0
End Sub
'==================================================
谁能帮我讲讲上面代码什么意思
2008-04-25 09:15
快速回复:求助!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016063 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved