Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing main resource from embedded applications ?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
For example, I have the main program (VC++) that embeds some COM objects. In some cases, I want these objects have the ability of modifying main application's resource, or vice versa. I know both main application and its components share the same module handle, so they can access resource handles of each other (?). But in my own tests, it works OK with menus, but faulty with bitmaps, strings...

Here's my code:

my_bmp = CBitmap::FromHandle(obj_rsc_handle);
my_toolbar.AddBitmap(my_bmp); //This toolbar doesn't display the bitmap

my_another_bitmap = LoadBitmap(app_rsc_handle);
my_another_toolbar.AddBitmap(my_another_bitmap); //This toolbar is OK

Here is my question: How to access the resource of a side from another side of this application ?

From previous topics, I know there is a way to do this, that is calling LoadLibraryEx to make another instance of which module you want to access its resource. But I think it seems to be a roundabout way. Maybe is there a better solution, within the given module only ? Is it supported in ATL ?

Appreciate your response.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top