Obtaining Resource ID from a CDocTemplate 
Author Message
 Obtaining Resource ID from a CDocTemplate

Given an instance of a CDocTemplate-derived class, how can I get the
associated resource ID?  It seems that the m_nIDResource member is protected
and unaccessable.

I need to access this member for the following reason (maybe someone could
suggest something else?):

I have an array of CDocTemplate pointers my application supports.  I have
overridden CWnd::OnFileNew() and display my own dialog box.  This dialog
contains a list view control that I want to fill with the description of
each template in the array (using the document string
CDocTemplate::regFileTypeName) and its associated small (16x16) icon.  I'd
like to just pass my array of CDocTemplate pointers to the dialog, not an
additional array of resource identifiers, as well.

It seems that there should be a way of obtaining the icon (or any other
resource) associated with a CDocTemplate when given the CDocTemplate object.



Mon, 31 Jul 2000 03:00:00 GMT  
 Obtaining Resource ID from a CDocTemplate

Hi, you could create a little subclass to get access to the protected part
of it's baseclass.
    class CMyDocTemplate : public CDocTemplate
        UINT GetResourceID()
            {  return m_nIDResource;  }
and use it like:
UINT nResourceID = ((CMyDocTemplate*)pDocTemplate)->GetResourceID();
hope that helps...

Tue, 01 Aug 2000 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Manual mod of string resource ids causes failed resource load

2. Open a binary file as a resource with resource ID

3. Resource IDs / Resource.h

4. Obtaining a cpu id

5. Obtaining 95 Logon and/or Netware Login ID's

6. How to obtain Process ID If I have process handle

7. Obtaining Login ID, Machine Name

8. Obtaining Menu ID for Visual C++ from another application

9. How to obtain an NIC's ID

10. Obtaining Login ID, Machine Name

11. Parsing the Unique ID obtained from the Processor

12. Obtaining FileVersion / ProductVersion from the version resource in Visual C++ 5.0


Powered by phpBB® Forum Software