Announcement

Collapse
No announcement yet.

Get resource type using only the resource name?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • colin glenn
    replied
    As an example, in many of Penzold's examples, he uses the program's name as the class name, the menu name, the icon name, ...

    Leave a comment:


  • Michael Mattias
    replied
    >that would give the type for a supplied resource name

    Not possible: For any module you can have more than one resource with any given name, all of different types.

    Leave a comment:


  • Anthony Watson
    replied
    Thanks Michael and Edwin!

    I saw the EnumResourceTypes on MSDN, but it would involve too much code for the simple task I'm trying to accomplish. I was hoping for a single API call or something that would give the type for a supplied resource name. I don't want to go to the trouble of enumerating all the available resources just to find the type of a single resource. It's easier just to pass the type as a variable to my subroutine.

    Thanks!

    Anthony

    Leave a comment:


  • Michael Mattias
    replied
    >Wasn't there an enumresources() ?

    Nope.

    But....

    You can EnumResourceTypes(), then in your callback for that, do an EnumResourceNames() for that type... you'll end up with a list of all resources in the target module by name and type.

    MCM

    FWIW, this is legal
    Code:
    FOO   BITMAP  filename
    FOO  ICON      filename
    FOO  RCDATA   filename 
    FOO  DIALOG
    Can't very well ask if the resource named FOO is a bitmap, can you? There's a BITMAP FOO to be sure, but there is also an ICON FOO, a DIALOG named FOO, an RCDATA named FOO... and a boy named Sue, too.
    Last edited by Michael Mattias; 14 Apr 2009, 06:22 PM.

    Leave a comment:


  • Edwin Knoppert
    replied
    Wasn't there an enumresources() ?

    Leave a comment:


  • Get resource type using only the resource name?

    Is there any way to determine what "type" an object in a resource file from just the resource name?

    For example, my resource file has these two objects defined:

    Code:
    PROGRAM ICON home.ICO
    TITLE BITMAP title.bmp
    If I only have the name (i.e. "TITLE") is there any way to determine programatically that it is a BITMAP resource type?

    Thanks,

    Anthony
Working...
X