Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » I ask for advice about resource assignment. Collapse All
Subject Author Date
tera tera Nov 5, 2008 - 11:57 PM

Hello.


Even if the BITMAP resource ID is different in DLL, is it necessary to do it uniquely?


A.DLL

IDB_PICBITMAP1   1234

IDB_PICBITMAP2   1250


B.DLL

IDB_PICBITMAP1   1300

IDB_PICBITMAP2   1301


As well as BITMAP, Do I have to assign a unique ID number including a dialog and the string table?


But will the control such as IDC be good with the same ID number?

A.DLL

IDC_EDIT1        1500


B.DLL

IDC_EDIT1        1500


Thanks,


 

Technical Support Nov 6, 2008 - 7:05 AM

If all bitmap IDs are unique (even in different DLLs), you should always be able to load a required bitmap successfully using one of the following methods:

bool CExtResourceManager::LoadBitmap(
            CExtBitmap & _bitmap,
            __EXT_MFC_SAFE_LPCTSTR strResourceName,
            WORD * p_wLangIdOut, // = NULL
            HINSTANCE * p_hInstOut // = NULL
            )

bool CExtBitmap::LoadBMP_Resource(
            __EXT_MFC_SAFE_LPCTSTR sResourceID,
            __EXT_MFC_SAFE_LPCTSTR sResourceType, // = RT_BITMAP // default bitmap section
            HINSTANCE hInst, // = NULL // find it automatically
            bool bMake32, //= false
            bool bEnableThrowException // = false
            )
If bitmap resource identifiers are not equal in each of DLLs and in EXE, you should detect manually which DLL (or EXE) contains the required bitmap resource and use the following method:
bool CExtBitmap::LoadBMP_Resource(
            HINSTANCE hInst,
            HRSRC hRsrc,
            bool bMake32, //= false
            bool bEnableThrowException // = false
            )
You can define and use IDC_EDIT1 in several different DLL and EXE projects. It’s defined in the resource.h header file of each project. If A.DLL project includes into its .CPP files only its own resource.h file, then you will not come across with any problems. If your DLL projects will include resource.h file from different projects, then you will not be able to compile successfully because some of resource constants will be defined more than once using different values. This is incorrect and you can avoid this problem only by using unique names in resource pre-processor variables.