position of image

Ruhela used Ask the Experts™
how to find the position of image at slide. i extract the text and image but not find the image position.

//-----Extract the image------------
char PPT_JPEG_Header[] = "FF D8 FF";
char PPT_JPEG_Footer[] = "FF D9";

int FndDocImg(CString strTempPath, CString strBuffer, PDWORD pPositon, char* pHeader, char* pFooter, CString strImgType)
	long lHeader = 0, lFooter = 0;

	lHeader = strBuffer.Find(pHeader, *pPositon);
	lFooter = strBuffer.Find(pFooter, *pPositon);

	if(lHeader != -1 && lFooter != -1)
		*pPositon = lFooter + strlen(pFooter);
		lHeader = round((float)lHeader/3);
		lFooter = round((float)lFooter/3) + strlen(pFooter)/3;
		lFooter ++;
		long lLength = lFooter - lHeader;
		if(lLength > 0)
			FilteredImage(strTempPath, lHeader, lLength, strImgType);
	return 0;

//----position the image--------------
	long lPos = 516;
	FILE* fil;
	fil = fopen(strTempPath, "r");
	fseek(fil, lPos, SEEK_SET);
	unsigned long lNum;
	OnGetLong(fil, &lNum);

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Is your Find-Function correct?

int Find(
   PCXSTR pszSub,
   int iStart=0
) const throw( );

 A pointer to a const character string (either wchar_t or char) with the same character type as the CStringT object.
i think it searches only strings and not ByteValues AND a string ends with 0x00
PPT_JPEG_Header is not a string

do you get correct values from your Find-Function?


Not provided image offset in powerpoint.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial