shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
Originally Posted by lplover2k
it's not generated... i am getting error that it is missing
If its not generated delete the line wallpaper.h
lplover2k's Avatar, Join Date: Feb 2007
Go4Expert Member
when u say "Add a picture Box to your application"
is it the "picture" control??

the types available for are "frame","icon","bitmap","rectangle"Enhanced metafile"... still don't see "ownerdrawn"..... and where do i inlcude "picture.h" in my dialog class?
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
Originally Posted by lplover2k
when u say "Add a picture Box to your application"
is it the "picture" control??
Yes.

Quote:
Originally Posted by lplover2k
the types available for are "frame","icon","bitmap","rectangle"Enhanced metafile"... still don't see "ownerdrawn"..... and where do i inlcude "picture.h" in my dialog class?
Go through the tabs of the property window and you will see a checkbox of ownerdraw.
lplover2k's Avatar, Join Date: Feb 2007
Go4Expert Member
there's no "ownerdraw"... neither in styles nor extended styles too...




thanks for quick responses btw
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
You dont need to convert the style to owner draw and it will work perfectly fine. I have edited the article for the errors. Thanks for pointing that out.
lplover2k's Avatar, Join Date: Feb 2007
Go4Expert Member
thanks very much!!! i have finally managed to use it!!! this is a great piece of code !!! it's the simplest method to load bitmap!!! thanks !!!

i am glad i was helpful for your code correction

one question is there a way to load jpeg??
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
Originally Posted by lplover2k
one question is there a way to load jpeg??
You need GDI for that. I am planning to write one article on that but its lack of time at this moment.
lplover2k's Avatar, Join Date: Feb 2007
Go4Expert Member
cool i am impatient and thaNKs again
abdul_khathar's Avatar, Join Date: Nov 2006
Newbie Member
hi Shabbir!

In MFC application (Dialog based or Cform view), if i load bitmap image in the background, its taking more memory.. here is my coding..
Code:
void CDlg_Splash::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	HBITMAP m_Bmap;
	CRect rect;
	HDC memdc;
	
	CString m_ifilename1;
	
	m_ifilename1 = "C:\\test.bmp";
	
	GetClientRect(&rect);
	
	m_Bmap=(HBITMAP)::LoadImage(NULL,m_ifilename1,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
	memdc=::CreateCompatibleDC(dc.m_hDC);
	::SelectObject(memdc,m_Bmap);
	
	BitBlt(dc.m_hDC,0,0,rect.right,rect.bottom,memdc,0,0,SRCCOPY); 
	DeleteObject(m_Bmap);
	DeleteObject(memdc);
}
is it correct ? and also let me know is there any memory leakage?
is it possible to load jpeg image in MFC dialog? (to avoid more memory usage)

Thanks in Advance...





Abdul Khathar A

Last edited by shabbir; 9Aug2007 at 17:22.. Reason: Code block
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
You don't need to load the image in the Paint but can have the image loaded in the constructor and just display / Paint in the OnPaint