I wish to load images from database into memory and then render it to an appropriate section of a window?
The reason being that, I do not want copies of the images to be available as file on the system because they are mostly sensitive image that need to be secured and kept away from unauthourised person.
Is there a way I can render the image as mentioned above?
If no, which is the best way to achieve this kind of image security that I desire?
P.S.
The images are to be loaded from database.
NEW ADDITION:
below is a relevant section of code ahowing how I render image. I wish to take originalGruf's suggestion. I wish to load an Image file to memory decrypt it in memory and theen render to window. Is it possible to do it with a variation of the code below or must I use a completely different code.
Btw. How does one convert a file int a stream.
if(LoadOptional(szFilePath,sizeof(szFilePath),iStudentID,pStudEdit->m_iClassID))
{
if(lstrlen(szFilePath))
{
CFile *pFile = NULL;
try
{
pFile = new CFile(szFilePath,CFile::modeRead | CFile::shareDenyNone);
m_stFilePath = szFilePath;
Image image(m_stFilePath);
Graphics graphics(dc);
graphics.DrawImage(&image,m_rcImage.left,m_rcImage.top,m_rcImage.Width(),m_rcImage.Height());
}
catch (CFileException* pEx)
{
pEx->ReportError();
pEx->Delete();
}
catch(CMemoryException* pEx)
{
pEx->ReportError();
pEx->Delete();
AfxAbort();
}
if(pFile != NULL)
{
pFile->Close();
delete pFile;
}
}
Does this make sense?
CFile *pFile = NULL;
pFile = new CFile(m_stFilePath,CFile::modeRead | CFile::shareDenyNone);
DWORD dwFileSize = pFile->GetLength();
unsigned char *pBLOB = new unsigned char [m_dwFileSize];
if(pFile->Read(pBLOB,m_dwFileSize))
Image image((const char *)pBLOB);
Graphics graphics(dc);
graphics.DrawImage(&image,m_rcImage.left,m_rcImage.top,m_rcImage.Width(),m_rcImage.Height());