VoyForums

VoyUser Login optional ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 1234567[8]910 ]


[ Next Thread | Previous Thread | Next Message | Previous Message ]

Date Posted: 02:16:35 06/04/01 Mon
Author: Vivek
Subject: Out of Virtual Memory



I'm getting this error "Out of virtual Memory", with my following code. I'm calling this function in Timer routine.

void CTry2Dlg::DisplayBMP()
{

CString temp;
BITMAP bit,bit1;
int x,y;
//CPaintDC dc(this);
CClientDC dc(this);
HDC hdc,temp_hdc,temp_hdc1;
hdc = dc.GetSafeHdc();

if(toggle)
{

temp_hdc = CreateCompatibleDC(hdc);

m_Hbitmap = (HBITMAP)LoadImage(AfxGetInstanceHandle(), "D:\\old_D\\vib\\bmpconvertion\\102.bmp", IMAGE_BITMAP, 684, 512, LR_LOADFROMFILE/*|LR_CREATEDIBSECTION*/);
m_HbitmapNew = (HBITMAP)SelectObject(temp_hdc,m_Hbitmap);
GetObject(m_Hbitmap,sizeof(BITMAP),&bit);
x = bit.bmWidth;
y = bit.bmHeight;

BitBlt(hdc,0,0,x,y,temp_hdc,0,0,SRCCOPY);
SelectObject(temp_hdc,m_HbitmapNew);

DeleteObject(m_HbitmapNew);
DeleteDC(temp_hdc);
toggle = 0;
}
else
{
temp_hdc1 = CreateCompatibleDC(hdc);

m_Hbitmap1 = (HBITMAP)LoadImage(AfxGetInstanceHandle(), "D:\\old_D\\vib\\bmpconvertion\\103.bmp", IMAGE_BITMAP, 684, 512, LR_LOADFROMFILE/*|LR_CREATEDIBSECTION*/);
m_HbitmapNew1 = (HBITMAP)SelectObject(temp_hdc1,m_Hbitmap1);

GetObject(m_Hbitmap1,sizeof(BITMAP),&bit1);

x = bit1.bmWidth;
y = bit1.bmHeight;

BitBlt(hdc,0,0,x,y,temp_hdc1,0,0,SRCCOPY);
SelectObject(temp_hdc1,m_HbitmapNew1);

DeleteObject(m_HbitmapNew1);
DeleteDC(temp_hdc1);

toggle = 1;
}

}

This routine toggles between displaying of two Images read from a file.

Please help me out,

Thanks,
Vivek

[ Next Thread | Previous Thread | Next Message | Previous Message ]


Replies:


[ Contact Forum Admin ]


Forum timezone: GMT-5
VF Version: 2.94, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2008 Voyager Info-Systems. All Rights Reserved.