| |

VerySource

 Forgot password?
 Register
Search
View: 656|Reply: 3

I would like to ask how to display the received Yizheng jpg data, can it be displayed directly without decoding, or what

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-2-11 13:00:01
| Show all posts |Read mode
How do I display the received Yizheng jpg data, can it be displayed without decoding, or what library can be used to display the data directly?
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-4-7 21:00:01
| Show all posts
HRESULT CMySocket :: ShowPicBuffer (char * lpstr, int nScrWidth, int nScrHeight, long dwFileSize)
{
HDC hDC_Temp = GetDC ((CWnd *) AfxGetMainWnd ()-> m_hWnd);

IPicture * pPic;
IStream * pStm;

BOOL bResult;
// Allocate global storage space
HGLOBAL hGlobal = GlobalAlloc (GMEM_MOVEABLE, dwFileSize);
LPVOID pvData = NULL;

if (hGlobal == NULL)
return E_FAIL;

if ((pvData = GlobalLock (hGlobal)) == NULL) // lock allocated memory block
return E_FAIL;

memcpy (pvData, lpstr, dwFileSize);

GlobalUnlock (hGlobal);

CreateStreamOnHGlobal (hGlobal, TRUE,&pStm);

// Load graphic file

bResult = OleLoadPicture (pStm, dwFileSize, TRUE, IID_IPicture, (LPVOID *)&pPic);

if (FAILED (bResult))
return E_FAIL;

OLE_XSIZE_HIMETRIC hmWidth; // The true width of the picture
OLE_YSIZE_HIMETRIC hmHeight; // The true height of the picture
pPic-> get_Width (&hmWidth);
pPic-> get_Height (&hmHeight);

// Output graphics to the screen (somewhat like BitBlt)
bResult = pPic-> Render (hDC_Temp, 0,0, nScrWidth, nScrHeight, 0, hmHeight, hmWidth, -hmHeight, NULL);

pPic-> Release ();

if (SUCCEEDED (bResult))
{
return S_OK;
}
else
{
return E_FAIL;
}
}
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-5-7 19:45:01
| Show all posts
Tried it
pPic-> get_Width (&hmWidth); The length and width of the resulting image are incorrect, and it is several times larger than the original image. The displayed image is only a small part of the image. ? ? ? ?
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 Canada

 Author| Post time: 2020-5-18 11:00:01
| Show all posts
Thank yousmartwang
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list