U
user.braulio
Guest
Hi,
I'm trying to load an image on a button, so after Excel 'Invoke's my add-in and I identify the request as one to load an image, I read one from disk (just 32x32 pixels BMP file, solid black color, 24BPP) through LoadImage, get an 'Ipicture' object through 'OleCreatePictureIndirect', and call 'Render', but nothing happens, can somebody tell me what I'm doing wrong? This is what I'm doing, less error checking and other disturbing things:
/* The IPicture object I receive. */
IPicture *p;
/* It's VTABLE */
IPictureVtbl *pt = p->lpVtbl;
/* It's context */
pt->get_CurDC (p, &hdc);
/* It's width and height. */
pt->get_Width (p, &w);
pt->get_Height (p, &h);
/* Set a rect, have tried different ways */
rect.top = 0;
rect.left = 0;
rect.right = 32;
rect.bottom = 32;
/* And render, have also tried different ways. */
pt->Render (p, hdc, 0, 0, 32, 32, 0, h, w, -h, &rect);
All the functions succeed (and I get meaningful data out of my IPicture object before calling 'Render'), but no matter what I do, I can't see anything on the screen, and excel always complains the answer to this command didn't return a valid thing. I've also tried calling 'Invalidate' just to see if it would change anything. I always get 'E_INVALIDARG' from Render. Any ideas?
Thanks,
Continue reading...
I'm trying to load an image on a button, so after Excel 'Invoke's my add-in and I identify the request as one to load an image, I read one from disk (just 32x32 pixels BMP file, solid black color, 24BPP) through LoadImage, get an 'Ipicture' object through 'OleCreatePictureIndirect', and call 'Render', but nothing happens, can somebody tell me what I'm doing wrong? This is what I'm doing, less error checking and other disturbing things:
/* The IPicture object I receive. */
IPicture *p;
/* It's VTABLE */
IPictureVtbl *pt = p->lpVtbl;
/* It's context */
pt->get_CurDC (p, &hdc);
/* It's width and height. */
pt->get_Width (p, &w);
pt->get_Height (p, &h);
/* Set a rect, have tried different ways */
rect.top = 0;
rect.left = 0;
rect.right = 32;
rect.bottom = 32;
/* And render, have also tried different ways. */
pt->Render (p, hdc, 0, 0, 32, 32, 0, h, w, -h, &rect);
All the functions succeed (and I get meaningful data out of my IPicture object before calling 'Render'), but no matter what I do, I can't see anything on the screen, and excel always complains the answer to this command didn't return a valid thing. I've also tried calling 'Invalidate' just to see if it would change anything. I always get 'E_INVALIDARG' from Render. Any ideas?
Thanks,
Continue reading...