Print Page | Close Window

LoadBitmapFromResource on x64

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=20641
Printed Date: 15 November 2024 at 11:06pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: LoadBitmapFromResource on x64
Posted By: bob.fortin
Subject: LoadBitmapFromResource on x64
Date Posted: 27 February 2013 at 4:22pm
I am porting some code to run under a 64 bit windows exe.

IImageManagerIconsPtr pActiveIcons = GetActiveIconsPtr();

if (pActiveIcons) {
          HRESULT hr = pActiveIcons->LoadBitmapFromResource((long)lResourceInst, lSmallResId, CComVariant((LPSAFEARRAY)safeCommands), xtpImageNormal);
          ATLASSERT(SUCCEEDED(hr));

This works on 32bit codejock, but not on x64.
I have an hintance of a resource, which is a long on win32, but a 64bit value on x64. I am confused why the LoadBitmapFromResource method only takes a long as a parameter - forcing me to cast the 64bit pointer to 32bits, and making it not valid so that the call does not work.

The lResourceInst is 0x0000000180000000 which gets casted to 0x0000000080000000. The when I call LoadBitmapFromResource it returns success but the bitmap does not draw later and this shows in the debug window:

First-chance exception at 0x000007fb9808fbf7 in mapinfow.exe: 0xC0000005: Access violation reading location 0x0000000080000000.

Is there a way to call the com method with a 64bit instance handle? I am using wrappers generated by visual studio compilation.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net