473,414 Members | 1,596 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

How to pass a bitmap parameter to a COM object?

Hello
I'm using a COM control in VC++, and the way to pass a picture to the
control is throught this function
void SetObjImage(LPDISPATCH ObjImage);

I have found the way to pass this parameter creating an image throught
CBitmap and CPictureHolder classes:

CPictureHolder pictholder ;
CBitmap bmpAux ;
bmpAux.LoadBitmap (IDB_BITMAP1) ;
pictholder.CreateFromBitmap((HBITMAP)bmpAux.Detach (), NULL, TRUE);
m_obj.SetObjImage (pictholder.GetPictureDispatch ()) ;

but now I want to get the images from a CImageList

// now IDB_BITMAP2 has more than a image
COLORREF crMask = ::GetSysColor (COLOR_HIGHLIGHT) ;
CImageList *ImgLst = new CImageList () ;
ImgLst->Create (IDB_BITMAP2, 16, 100, crMask) ;
IMAGEINFO imgInfo ;
// Get the first image from the list
if (ImgLst->GetImageInfo (0, &imgInfo)) {
HBITMAP hbm = (HBITMAP)imgInfo.hbmImage ;
pictholder.CreateFromBitmap (hbm, NULL, TRUE) ;
m_obj.SetObjImage (pictholder.GetPictureDispatch ()) ;
} ;
delete ImgLst ;

This code doesn't works. It seems that anything is added to the
control, but I can't see the image.
Somebody knows why? How can I do this?
Thank you in advance.
Jul 22 '05 #1
1 2683

<ar************@yahoo.es> wrote in message
Hello
I'm using a COM control in VC++, and the way to pass a picture to the
control is throught this function
void SetObjImage(LPDISPATCH ObjImage);


Off-topic.
Please read this - http://www.slack.net/~shiva/welcome.txt . By not posting
and replying to them we maintain the signal to noise ratio on this
newsgroup.

Thank you.
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: CroDude | last post by:
Hi all! I have problems when writting bitmap to a byte array and after reading it back form byte to Bitmap object. What I do is this: First I throw Bitmap to a memory-stream and then I write it...
3
by: Bradford | last post by:
I have an Windows application that displays lots of different colored lines in a Panel by using the Graphics.DrawLine method. The location and length of each line comes from a database query that...
8
by: TJ | last post by:
I need to be able to pass a pointer to a (managed code) Stream object to a COM method so it can serialize its data into the stream. I have a C# application that makes uses of Randolf Duke's...
0
by: Sam | last post by:
I'm wondering if I can pass variables to "TestForm.aspx" with the way I'm using it. It's acting as a jpeg image and looks like: <%@ Page ContentType="image/Jpeg" %> <%@ Import...
8
by: Nathan Sokalski | last post by:
I am trying to write code to rotate a graphic that I have. Here is the code I am currently using: Dim frogbitmap As New Bitmap(Drawing.Image.FromFile(Server.MapPath("images/frog.gif"))) Dim...
7
by: Nathan Sokalski | last post by:
I am having a problem saving an image with the same name it originally had. I have two similar versions of my code, one in which I close the FileStream used to open the original image before saving,...
1
by: Smokey Grindel | last post by:
I have a bitmap object I want to return as a JPEG image with a compression set at 90% and progressive passes enabled, how can I do this in .NET 2.0? Progressive passes are not necessary but the...
0
MetalMartian
by: MetalMartian | last post by:
I'm trying to write code for a game based on the original Pacman in Visual Basic .NET 2003, however I can't figure out how to make the character move around the screen and not go through the walls....
8
by: Joergen Bech | last post by:
Suppose I have Dim bm As New Bitmap(16, 16,Imaging.PixelFormat.Format8bppIndexed) I cannot use Dim g As Graphics = Graphics.FromImage(bmdest) Dim hdc As IntPtr = g.GetHdc() as the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.