Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. OLE

OLE

Scheduled Pinned Locked Moved C / C++ / MFC
helpcom
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Aizaz
    wrote on last edited by
    #1

    Hi i am trying to use ole Ipicture interface to load pictures of different formats but the OleloadPicturePath method fails. What i am doing is given below. any help would be appreciated and a lot of thanks in advance. void * CMap::OpenGraphics(char * name) { IPicture *Ipic = NULL; SIZE metric,pixel; const int H_METRIC_PER_INCH = 2540; HDC hdcScreen =GetDC(NULL); HRESULT hr; int SxpixPerInc = GetDeviceCaps(hdcScreen,LOGPIXELSX); int SypixPerInc = GetDeviceCaps(hdcScreen,LOGPIXELSX); unsigned short OlePathName[512]; ReleaseDC(NULL,hdcScreen); mbstowcs(OlePathName,name,23); char s[10]; MessageBox(NULL,itoa(int(OlePathName),s,10),"OLE",MB_OK); hr = OleLoadPicturePath(OlePathName,NULL,0,0,IID_IPicture,(void **)(Ipic)); if(hr) { MessageBox(NULL,"ERROR WHILE LOADING PIC PATH","",MB_OK); return 0; } if(Ipic) { Ipic->get_Height(&metric.cy); Ipic->get_Width(&metric.cx); pixel.cx = (SxpixPerInc*metric.cx + H_METRIC_PER_INCH/2)/H_METRIC_PER_INCH; pixel.cy = (SypixPerInc*metric.cy + H_METRIC_PER_INCH/2)/H_METRIC_PER_INCH; ImageInfo.Ipic = Ipic; ImageInfo.pixel = pixel; ImageInfo.metric=metric; ImageInfo.path = name; return Ipic; } return 0; }

    F 1 Reply Last reply
    0
    • A Aizaz

      Hi i am trying to use ole Ipicture interface to load pictures of different formats but the OleloadPicturePath method fails. What i am doing is given below. any help would be appreciated and a lot of thanks in advance. void * CMap::OpenGraphics(char * name) { IPicture *Ipic = NULL; SIZE metric,pixel; const int H_METRIC_PER_INCH = 2540; HDC hdcScreen =GetDC(NULL); HRESULT hr; int SxpixPerInc = GetDeviceCaps(hdcScreen,LOGPIXELSX); int SypixPerInc = GetDeviceCaps(hdcScreen,LOGPIXELSX); unsigned short OlePathName[512]; ReleaseDC(NULL,hdcScreen); mbstowcs(OlePathName,name,23); char s[10]; MessageBox(NULL,itoa(int(OlePathName),s,10),"OLE",MB_OK); hr = OleLoadPicturePath(OlePathName,NULL,0,0,IID_IPicture,(void **)(Ipic)); if(hr) { MessageBox(NULL,"ERROR WHILE LOADING PIC PATH","",MB_OK); return 0; } if(Ipic) { Ipic->get_Height(&metric.cy); Ipic->get_Width(&metric.cx); pixel.cx = (SxpixPerInc*metric.cx + H_METRIC_PER_INCH/2)/H_METRIC_PER_INCH; pixel.cy = (SypixPerInc*metric.cy + H_METRIC_PER_INCH/2)/H_METRIC_PER_INCH; ImageInfo.Ipic = Ipic; ImageInfo.pixel = pixel; ImageInfo.metric=metric; ImageInfo.path = name; return Ipic; } return 0; }

      F Offline
      F Offline
      f64
      wrote on last edited by
      #2

      Hi there, You are missing an & in front of Ipic.

      hr = OleLoadPicturePath(OlePathName,NULL,0,0,IID_IPicture,(void **)(**&**Ipic));

      Fabian

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups