Date: 02-16-2022
Return to Index
created by gbSnippets
'SetProp ... (ByVal hWnd As Dword, lpString As Asciiz, ByVal hData As Dword) As Long
'GetProp ... (ByVal hWnd As Dword, lpString As Asciiz) As Long
'The application must use the RemoveProp function to remove the entries.
Local sTitle as AsciiZ * 100
sTitle = "Title"
SetProp hDlg, sTitle,
iResult = GetProp hDlg, "Title" '
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
Global hDlg As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "Test Code",300,300,200,200, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, 100,"Set Property", 50,10,100,20
Control Add Button, hDlg, 200,"Get Property", 50,50,100,20
Control Add Button, hDlg, 300,"Set Properties", 50,90,100,20
Control Add Button, hDlg, 400,"Retrieve All", 50,130,100,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local i As Long, s As String, pstr As String Ptr, zReturnedString As Asciiz * %Max_Path, temp$
Static zDataString, zNameString As Asciiz * %Max_Path
Static zTitle As Asciiz * 100
Select Case Cb.Msg
Case %WM_Command
Select Case Cb.Ctl
Case 100
zNameString = "Name"
zDataString = "Data"
SetProp hdlg, zNameString, VarPtr(zDataString)
Case 200
pstr = GetProp(hDlg, zNameString)
zReturnedString = @pstr
? zReturnedString
Case 300
'store 5 property values
For i = 501 To 505
zTitle = "Title" + Trim$(Str$(i)) : SetProp hDlg, zTitle, i
Next i
Case 400
EnumProps(hDlg, CodePtr(Capture))
? Trim$(temp$, $CrLf)
End Select
End Select
End Function
Function Capture(hWnd As Dword, zTitle As Asciiz * 100, hData As Dword) As Long
Local temp$
Static iCount As Long
Incr iCount
temp$ = temp$ + $CrLf + Str$(iCount) + " : " + zTitle + " : " '+ str$(hData)
Function = 1
End Function
'gbs_01009
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm