I am trying to save the clipboard content as a bmp file. I tried like this:
I am getting NULL in hBmp. So if condition fails. I tried to get the error code. But error message says "Function completed successfully". Can anyone help me where i went wrong??
hBmp = GetClipboardData(CF_DIB);
if (WriteDIB("c:\\TEST.BMP",GetClipboardData(CF_DIB)) == TRUE)
void printerror(long err)
MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
Thanks in advance,
I can't see why GetLastError() would return that value. Very strange.
Note that you should delete lpMsgBuffer to prevent a memory leak.
I tried with other constant like CF_BITMAP. Again I am getting hBmp to zero.
But one thing i noticed. If I place CF_TEXT in GetClipboardData() then I am getting a valid handle i.e. valid hBmp. But since it is in text I am not able to write the contents as bmp file. So whats really going on here.
Can anyone help me!!