可否贴上来告诉我下!
我电脑中的帮助文档找不到这个函数,搜索到的资料也都没有说明得比较详细。所以才来这边向大家拿拿看~~~~~`
实例。。他们发的API查询器不是有吗。。。。。下下来看下不就知道了。。。
不过没什么说明。。。实例到有一个
'Create a new project, add a module to it
'Add a command button to Form1
'In the form
Private Sub Form_Load()
'Joforn 2007
'Blog:Http://Blog.163.com/Joforn/
'E-Mail: Joforn@sohu.com
'Subclass this form
HookForm Me
'Register this form as a Clipboardviewer
SetClipboardViewer Me.hwnd
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Unhook the form
UnHookForm Me
End Sub
Private Sub Command1_Click()
'Change the clipboard
Clipboard.Clear
Clipboard.SetText "Hello !"
End Sub
'In a module
'These routines are explained in our subclassing tutorial.
'http://www.allapi.net/vbtutor/subclass.htm
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong 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
Declare Function SetClipboardViewer Lib "user32" (ByVal hwnd As Long) As Long
Public Const WM_DRAWCLIPBOARD = &H308
Public Const GWL_WNDPROC = (-4)
Dim PrevProc As Long
Public Sub HookForm(F As Form)
PrevProc = SetWindowLong(F.hwnd, GWL_WNDPROC, AddressOf WindowProc)
End Sub
Public Sub UnHookForm(F As Form)
SetWindowLong F.hwnd, GWL_WNDPROC, PrevProc
End Sub
Public Function WindowProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
WindowProc = CallWindowProc(PrevProc, hwnd, uMsg, wParam, lParam)
If uMsg = WM_DRAWCLIPBOARD Then
MsgBox "Clipboard changed ..."
End If
End Function
【VB声明】
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
【别名】
SetWindowLongA
【说明】
在窗口结构中为指定的窗口设置信息
【返回值】
Long,指定数据的前一个值
【参数表】
hwnd ---------------- Long,欲为其取得信息的窗口的句柄
nIndex -------------- Long,请参考GetWindowLong函数的nIndex参数的说明
dwNewLong ----------- Long,由nIndex指定的窗口信息的新值