Click here to Skip to main content
16,014,860 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Display WINWORD on a dialog Pin
Braulio Dez2-Apr-02 22:50
Braulio Dez2-Apr-02 22:50 
GeneralSynchronization... Pin
Neha2-Apr-02 19:50
Neha2-Apr-02 19:50 
GeneralRe: Synchronization... Pin
Joaquín M López Muñoz2-Apr-02 20:42
Joaquín M López Muñoz2-Apr-02 20:42 
GeneralRe: Synchronization... Pin
Neha2-Apr-02 21:11
Neha2-Apr-02 21:11 
GeneralRe: Synchronization... Pin
Tim Smith3-Apr-02 2:20
Tim Smith3-Apr-02 2:20 
GeneralRe: Synchronization... Pin
Neha3-Apr-02 16:47
Neha3-Apr-02 16:47 
GeneralRe: Synchronization... Pin
Joel Lucsy3-Apr-02 11:45
Joel Lucsy3-Apr-02 11:45 
GeneralAARRRGGG! Retreive/Store image in DB Pin
LukeV2-Apr-02 17:30
LukeV2-Apr-02 17:30 
Anyone knows how to retreive/store an image in a MDB file? I'm using CByteArray and it does not work! I know there's an article on CP that is using CLongBinary but it does not suit my needs (it uses a tmp file, I need an HBITMAP).

HBITMAP CdbCieSet::GetLogo()
{
CByteArray Array;

Array.Copy( m_logo );

if( Array.GetSize() <= 0 )
{
return NULL;
}

// the header of BLOB is OLE stuff like "Paint Brush Application" .... ecc..
// the len is 78 byte ( I do not know for other headers )
int HeaderLen = 78 + sizeof(BITMAPFILEHEADER);
Array.RemoveAt( 0, HeaderLen ); // I cut all Headers

// some BMP information
BITMAPINFOHEADER &bmiHeader = *(LPBITMAPINFOHEADER)Array.GetData() ;
BITMAPINFO &bmInfo = *(LPBITMAPINFO)Array.GetData() ;


// If bmiHeader.biClrUsed is zero we have to infer the number
// of colors from the number of bits used to specify it.
int nColors = bmiHeader.biClrUsed ? bmiHeader.biClrUsed : 1 << bmiHeader.biBitCount;

LPVOID lpDIBBits;
if( bmInfo.bmiHeader.biBitCount > 8 )
{
lpDIBBits = (LPVOID)((LPDWORD)(bmInfo.bmiColors + bmInfo.bmiHeader.biClrUsed) +
((bmInfo.bmiHeader.biCompression == BI_BITFIELDS) ? 3 : 0));
}
else
{
lpDIBBits = (LPVOID)(bmInfo.bmiColors + nColors);
}

CClientDC dc(NULL);

HBITMAP hBmp = CreateDIBitmap( dc.m_hDC, // handle to device context
&bmiHeader, // pointer to bitmap size and format data
CBM_INIT, // initialization flag
lpDIBBits, // pointer to initialization data
&bmInfo, // pointer to bitmap color-format data
DIB_RGB_COLORS); // color-data usage

Array.RemoveAll(); //Release Memory

return hBmp;
}

BOOL CdbCieSet::SetLogo(CString szFileName)
{
CByteArray BlobFile;
CFile aFile(szFileName,CFile::modeRead);
BlobFile.SetSize(aFile.GetLength());
aFile.Read(BlobFile.GetData(),aFile.GetLength());
aFile.Close();
m_logo.Copy(BlobFile);
SetFieldDirty(&m_logo);
SetFieldNull(&m_logo,FALSE);

return TRUE;
}

Thanks!

---------------
http://www.edovia.com
GeneralRe: AARRRGGG! Retreive/Store image in DB Pin
LukeV3-Apr-02 3:11
LukeV3-Apr-02 3:11 
GeneralCreating/Using DLL problem Pin
2-Apr-02 17:20
suss2-Apr-02 17:20 
GeneralRe: Creating/Using DLL problem Pin
Joaquín M López Muñoz2-Apr-02 18:55
Joaquín M López Muñoz2-Apr-02 18:55 
GeneralRe: Creating/Using DLL problem Pin
2-Apr-02 20:39
suss2-Apr-02 20:39 
GeneralRe: Creating/Using DLL problem Pin
Alexandru Savescu2-Apr-02 19:55
Alexandru Savescu2-Apr-02 19:55 
Questionhow to catch Dial-up dialog ???? Pin
Le Nhan2-Apr-02 17:11
Le Nhan2-Apr-02 17:11 
AnswerRe: how to catch Dial-up dialog ???? Pin
Mazdak2-Apr-02 18:40
Mazdak2-Apr-02 18:40 
GeneralLinking error in VC++.NET Pin
Adam Clauss2-Apr-02 16:45
Adam Clauss2-Apr-02 16:45 
GeneralRe: Linking error in VC++.NET Pin
Mike Nordell2-Apr-02 22:14
Mike Nordell2-Apr-02 22:14 
GeneralRe: Linking error in VC++.NET Pin
Adam Clauss3-Apr-02 2:39
Adam Clauss3-Apr-02 2:39 
GeneralRe: Linking error in VC++.NET Pin
Tim Smith3-Apr-02 2:23
Tim Smith3-Apr-02 2:23 
GeneralRe: Linking error in VC++.NET Pin
Adam Clauss3-Apr-02 2:38
Adam Clauss3-Apr-02 2:38 
QuestionDoes this cause the memory leak when I draw on a view? Pin
Feng Qin2-Apr-02 15:58
Feng Qin2-Apr-02 15:58 
AnswerRe: Does this cause the memory leak when I draw on a view? Pin
Paul M Watt2-Apr-02 16:41
mentorPaul M Watt2-Apr-02 16:41 
GeneralRe: Does this cause the memory leak when I draw on a view? Pin
Feng Qin2-Apr-02 18:02
Feng Qin2-Apr-02 18:02 
GeneralRe: Does this cause the memory leak when I draw on a view? Pin
Paul M Watt2-Apr-02 19:19
mentorPaul M Watt2-Apr-02 19:19 
GeneralRe: Does this cause the memory leak when I draw on a view? Pin
Feng Qin2-Apr-02 23:10
Feng Qin2-Apr-02 23:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.