Buffer to HDC handle
-
I have an 3 rd party API that will a fill a buffer of type LPSTR, This buffer is actually in picture format, i have to convert make this appear in a CStatic control. what i have: BYTE pBuffer; HDC hDC; //HDC handle for the CSttaic Control API will fill this pBuffer (LPSTR)pBuffer I have to make this pBuffer to appear in picture format in CStatic control. Would apprecaite any help.
-
I have an 3 rd party API that will a fill a buffer of type LPSTR, This buffer is actually in picture format, i have to convert make this appear in a CStatic control. what i have: BYTE pBuffer; HDC hDC; //HDC handle for the CSttaic Control API will fill this pBuffer (LPSTR)pBuffer I have to make this pBuffer to appear in picture format in CStatic control. Would apprecaite any help.
What do you mean with '
in picture format
' ? :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
What do you mean with '
in picture format
' ? :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]This "pBuffer" i can save it as a Bitmap format like this..... But i want to draw this pBuffer into a CStatic without converting to Bitmap... CFile file; CString strTemp; char szTemp[MAX_PATH]; char *pDot; GetModuleFileName(AfxGetInstanceHandle(),szTemp,sizeof(szTemp)); pDot = strrchr(szTemp,'.'); *(pDot+1) = 'B'; *(pDot+2) = 'M'; *(pDot+3) = 'P'; strTemp.Format(szTemp,GetTickCount()); file.Open(strTemp,CFile::modeCreate | CFile::modeWrite); file.Write(pBuffer,dwSize); file.Close();
-
I have an 3 rd party API that will a fill a buffer of type LPSTR, This buffer is actually in picture format, i have to convert make this appear in a CStatic control. what i have: BYTE pBuffer; HDC hDC; //HDC handle for the CSttaic Control API will fill this pBuffer (LPSTR)pBuffer I have to make this pBuffer to appear in picture format in CStatic control. Would apprecaite any help.
According to your answer to CPallini, your buffer contains a BMP file. So, wiki[^] should contain all the information you need to access the pixel data. Also look for BITMAPFILEHEADER, BITMAPINFO and such structures in MSDN, these should help too. You could for example use CreateDIBSection[^] to get a HBITMAP from your data and use it to feed it to a picture (static) control or draw it yourself.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <