OLE
-
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; }
-
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; }