函数功能:该函数从给定窗口的属性列表中检索数据句柄。给定的字符串标识了要检索的句柄。该字符串和句柄必须在前一次调用SetProp函数时已经加到属性表中。 函数原型:HANDLE GetProp(HWND hWnd,LPCTSTR lpString); 参数: hWnd:指向要搜索属性表的窗口。 LpString:指向以null结尾的字符串指针,或者包含一个标识字符串的原子。如果该参数是一个原子,那么它必须是使用GlobalAddAtom函数创建的。原子是16位的数据值,它必须是放置在lpstring参数的低位率中,而高位字必须为O。 返回值:如果属性表中包含了给定的字符串,那么返回值为相关的数据句柄。否则,返回值为NULL。 速查:Windows NT:3.1以上版本;Windows:95以上版本;Windows CE:不支持:头文件:winuser.h;库文件:user32。lib;Unicode:在Windows NT环境中以Unicode和ANSI版本实现。
'in a module
Declare Function GetProp Lib "user32" Alias "GetPropA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Declare Function SetProp Lib "user32" Alias "SetPropA" (ByVal hwnd As Long, ByVal lpString As String, ByVal hData As Long) As Long
Declare Function RemoveProp Lib "user32" Alias "RemovePropA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Declare Function EnumProps Lib "user32" Alias "EnumPropsA" (ByVal hwnd As Long, ByVal lpEnumFunc As Long) As Long
Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long
Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" (ByVal lpString1 As String, ByVal lpString2 As Long) As Long
Function PropEnumProc(ByVal hwnd As Long, ByVal lpszString As Long, ByVal hData As Long) As Boolean
Dim Buffer As String
'create ab buffer
Buffer = Space(lstrlen(lpszString) + 1)
'copy the string to the buffer
lstrcpy Buffer, lpszString
'show the buffer
Form1.Print Buffer
'continue enumeration
PropEnumProc = True
End Function
'in a form
Private Sub Form_Load()
'set the form's graphic mode to persistent
Me.AutoRedraw = True
'create a new property and set its value to 123
SetProp Me.hwnd, "TestProp", 123
'retrieve the value and show it
MsgBox "Property Value:" + Str(GetProp(Me.hwnd, "TestProp"))
'begin the enumeration
EnumProps Me.hwnd, AddressOf PropEnumProc
'remove the property
RemoveProp Me.hwnd, "TestProp"
End Sub
'in a module
Declare Function GetProp Lib "user32" Alias "GetPropA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Declare Function SetProp Lib "user32" Alias "SetPropA" (ByVal hwnd As Long, ByVal lpString As String, ByVal hData As Long) As Long
Declare Function RemoveProp Lib "user32" Alias "RemovePropA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Declare Function EnumProps Lib "user32" Alias "EnumPropsA" (ByVal hwnd As Long, ByVal lpEnumFunc As Long) As Long
Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long
Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" (ByVal lpString1 As String, ByVal lpString2 As Long) As Long
Function PropEnumProc(ByVal hwnd As Long, ByVal lpszString As Long, ByVal hData As Long) As Boolean
Dim Buffer As String
'create ab buffer
Buffer = Space(lstrlen(lpszString) + 1)
'copy the string to the buffer
lstrcpy Buffer, lpszString
'show the buffer
Form1.Print Buffer
'continue enumeration
PropEnumProc = True
End Function
'in a form
Private Sub Form_Load()
'set the form's graphic mode to persistent
Me.AutoRedraw = True
'create a new property and set its value to 123
SetProp Me.hwnd, "TestProp", 123
'retrieve the value and show it
MsgBox "Property Value:" + Str(GetProp(Me.hwnd, "TestProp"))
'begin the enumeration
EnumProps Me.hwnd, AddressOf PropEnumProc
'remove the property
RemoveProp Me.hwnd, "TestProp"
End Sub
解决方案 »
- access字段名称中不能含有“.”么
- 在VB中如何设置 DataReport 打印的页面长度,我用POS打印,不想有分页,可是他才自动分页!
- VB如何向WEB提交数据!!???高手指点!立马给分
- 请问如何用代码实现timer的功能,比如一秒之后raise一个event?
- 关于frame的一点点小问题
- 当一个TEXT型控件未录入任何值,
- vb编程实现统计文本框内相同字母出现的次数
- http://www.csdn.net/expert/topic/549/549121.xml打包的问题,再加100分!!!!
- MSHFlexGrid高手请进
- 自制的FLATBUTTON,谁想要留个EMAIL,如果觉得不错可以给我分
- 高分寻求答案
- 禁止Windows热键
兄弟,不用给分的么?