Ver Mensaje Individual
  #5 (permalink)  
Antiguo 31/01/2007, 04:42
Avatar de DeYoN
DeYoN
 
Fecha de Ingreso: febrero-2004
Mensajes: 81
Antigüedad: 21 años, 1 mes
Puntos: 0
Re: OleLoadPicture Cuelgue

El problema es que "hr" no devuelve nada, porque se queda colgado:

Código:
	BOOL bResult = FALSE;

	HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, nSize);

	if(hGlobal == NULL)
		{
		return(FALSE);
		}

	void* pData = GlobalLock(hGlobal);
	memcpy(pData, pBuffer, nSize);
	GlobalUnlock(hGlobal);

	IStream* pStream = NULL;

	if(CreateStreamOnHGlobal(hGlobal, TRUE, &pStream) == S_OK)
		{
		HRESULT hr;
		if((hr = OleLoadPicture(pStream, nSize, FALSE, IID_IPicture, (LPVOID *)&m_IPicture)) == E_NOINTERFACE)
			{
			return(FALSE);
			}
		else // S_OK
			{
			if (m_IPicture != NULL)
			{
				m_IPicture->get_Height(&m_Height);
				m_IPicture->get_Width(&m_Width);
				m_IPicture->get_Type(&m_Type);
			}
			pStream->Release();
			pStream = NULL;
			bResult = TRUE;
			m_Type = DetectarType(pBuffer, nSize);
			}
		}

	FreeResource(hGlobal); // 16Bit Windows Needs This (32Bit - Automatic Release)
Decir que he probado cn algunas otras imagenes corruptas, y si que funciona bien, pero cn esta en concreto nose por que da problemas.
¿Es posible que por el algoritmo de descompresión entre en algun bucle infinito? (son conjeturas)
¿Hay algun sitio donde pueda subir la imagen para que la probeis?


Gracias y saludos.