home *** CD-ROM | disk | FTP | other *** search
/ Dan Appleman's Visual Bas…s Guide to the Win32 API / Dan.Applmans.Visual.Basic.5.0.Programmers.Guide.To.The.Win32.API.1997.Ziff-Davis.Press.CD / VB5PG32.mdf / vbpg32 / samples5 / ch15 / resource.bas < prev    next >
Encoding:
BASIC Source File  |  1996-12-19  |  3.4 KB  |  91 lines

  1. Attribute VB_Name = "Module1"
  2. Option Explicit
  3.  
  4. Public Const RT_CURSOR = 1&
  5. Public Const RT_BITMAP = 2&
  6. Public Const RT_ICON = 3&
  7. Public Const RT_MENU = 4&
  8. Public Const RT_DIALOG = 5&
  9. Public Const RT_STRING = 6&
  10. Public Const RT_FONTDIR = 7&
  11. Public Const RT_FONT = 8&
  12. Public Const RT_ACCELERATOR = 9&
  13. Public Const RT_RCDATA = 10&
  14. Public Const RT_MESSAGETABLE = 11
  15. Public Const RT_GROUP_CURSOR = 12
  16. Public Const RT_GROUP_ICON = 14
  17. Public Const RT_VERSION = 16
  18. Public Const RT_DLGINCLUDE = 17
  19. Public Const RT_PLUGPLAY = 19
  20. Public Const RT_VXD = 20
  21.  
  22. ' This callback represents the EnumResourceTypes callback
  23. ' hmod is the module handle.
  24. ' restype is the type.
  25. ' userdef is user defined.
  26. Public Function Callback1_cbxLLL(ByVal hmod As Long, ByVal restype As Long, ByVal userdef As Long) As Long
  27.     ' If the high word is zero, this is a standard
  28.     ' resource type.
  29.     If (restype And &HFFFF0000) = 0 Then
  30.         Select Case restype
  31.             Case RT_CURSOR
  32.                 frmResource.lstTypes.AddItem "Cursors"
  33.             Case RT_BITMAP
  34.                 frmResource.lstTypes.AddItem "Bitmaps"
  35.             Case RT_ICON
  36.                 frmResource.lstTypes.AddItem "Icons"
  37.             Case RT_MENU
  38.                 frmResource.lstTypes.AddItem "Menu"
  39.             Case RT_DIALOG
  40.                 frmResource.lstTypes.AddItem "Dialog"
  41.             Case RT_STRING
  42.                 frmResource.lstTypes.AddItem "String"
  43.             Case RT_FONTDIR
  44.                 frmResource.lstTypes.AddItem "Font Directory"
  45.             Case RT_FONT
  46.                 frmResource.lstTypes.AddItem "Font"
  47.             Case RT_ACCELERATOR
  48.                 frmResource.lstTypes.AddItem "Accelerator"
  49.             Case RT_RCDATA
  50.                 frmResource.lstTypes.AddItem "RCData"
  51.             Case RT_MESSAGETABLE
  52.                 frmResource.lstTypes.AddItem "Message Table"
  53.             Case RT_GROUP_CURSOR
  54.                 frmResource.lstTypes.AddItem "Cursor (hardware independent)"
  55.             Case RT_GROUP_ICON
  56.                 frmResource.lstTypes.AddItem "Icon (hardware independent)"
  57.             Case RT_VERSION
  58.                 frmResource.lstTypes.AddItem "Version"
  59.             Case RT_PLUGPLAY
  60.                 frmResource.lstTypes.AddItem "Plug & Play Info"
  61.             Case Else
  62.                 frmResource.lstTypes.AddItem Hex$(restype)
  63.         End Select
  64.         frmResource.lstTypes.ItemData(frmResource.lstTypes.NewIndex) = restype
  65.     Else    ' The resource type is defined by a string
  66.         frmResource.lstTypes.AddItem agGetStringFromPointer(restype)
  67.         frmResource.lstTypes.ItemData(frmResource.lstTypes.NewIndex) = 0
  68.     End If
  69.     Callback1_cbxLLL = True
  70. End Function
  71.  
  72.  
  73. ' The cbkNames callback is used for EnumResourceNames
  74. ' hmod is the module handle
  75. ' restype is the resource type
  76. ' resid is the resource name or id
  77. ' userdef is user defined
  78. Public Function cbkNames_cbxLLLL(ByVal hmod As Long, ByVal restype As Long, ByVal resid As Long, ByVal userdef As Long) As Long
  79.     ' The resource has a name or identifier depending on whether
  80.     ' the high word is zero.
  81.     If (resid And &HFFFF0000) <> 0 Then
  82.         ' Show the resource name
  83.         frmResource.lstNames.AddItem agGetStringFromPointer(resid)
  84.     Else
  85.         ' Show the resource Identifier
  86.         frmResource.lstNames.AddItem Hex$(resid)
  87.     End If
  88.     cbkNames_cbxLLLL = True
  89. End Function
  90.  
  91.