Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
#Include "CommCtrl.inc"
#Resource "gbsnippets.pbr"
Global hDlg as DWord, rNames$, rType&
Function PBMain() As Long
Dialog New Pixels, 0, "Test Code",300,300,200,200, %WS_OverlappedWindow To hDlg
rType& = %RT_Bitmap
Control Add Button, hDlg, 100,"Get Resource Names", 20,10,160,20
Control Add Option, hDlg, 200,"Bitmap", 30,40,80,20
Control Add Option, hDlg, 300,"Icon", 110,40,80,20
Control Set Option hDlg, 200,200,300
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Select Case CB.Msg
Case %WM_Command
Select Case CB.Ctl
Case 100
EnumResourceNames GetModuleHandle(""), ByVal rType&, CodePTR(EnumResNameProc), 0
MsgBox rNames$
Case 200 : rType& = %RT_Bitmap
Case 300 : rType& = %RT_Icon
End Select
End Select
End Function
Function EnumResNameProc (ByVal hModule AS DWord, ByVal lpszType As AsciiZ PTR, _
ByVal lpszName As AsciiZ PTR, ByVal lParam As Long) As Long
Local strType AS String, strName AS String
If xIs_IntResource(lpszName) Then
strName = "#" + Format$(lpszName)
Else
strName = @lpszName
End If
rNames$ = rNames$ + $crlf + strName
Function = %TRUE
End Function
Function EnumResNameProc2 (ByVal hModule AS DWord, ByVal lpszType As AsciiZ PTR, _
ByVal lpszName As AsciiZ PTR, ByVal lParam As Long) As Long
Local strType AS String, strName AS String
If (lpszType AND &HFFFF0000) Then
strType = @lpszType
Else
strType = "#" + Format$(lpszType)
End If
If (lpszName AND &HFFFF0000) Then
strName = @lpszName
Else
strName = "#" + Format$(lpszName)
End If
rNames$ = rNames$ + $crlf + strName
Function = %TRUE
End Function
Function xIS_INTRESOURCE (ByVal dwInteger AS DWord) As Long
Shift RIGHT dwInteger, 16
Function = (dwInteger = 0)
End Function
'gbs_00473
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm