Click here to Skip to main content
15,214,867 members

C / C++ / MFC

 
QuestionSTL list member function(S) Pin
Amr.Mohammad8719-Nov-15 7:05
MemberAmr.Mohammad8719-Nov-15 7:05 
AnswerRe: STL list member function(S) Pin
Chris Losinger19-Nov-15 7:41
professionalChris Losinger19-Nov-15 7:41 
GeneralRe: STL list member function(S) Pin
Amr.Mohammad8719-Nov-15 12:47
MemberAmr.Mohammad8719-Nov-15 12:47 
GeneralRe: STL list member function(S) Pin
CPallini19-Nov-15 21:26
mveCPallini19-Nov-15 21:26 
QuestionMessage Closed Pin
19-Nov-15 4:19
Memberahuwbdhh1 Lolay19-Nov-15 4:19 
QuestionMessage Closed Pin
19-Nov-15 4:10
Member이진성19-Nov-15 4:10 
QuestionReturning CBitmap* pointer Pin
_Flaviu18-Nov-15 20:15
Member_Flaviu18-Nov-15 20:15 
I have wrote a method that load and rescale a CBitmap:
CBitmap* CMyDlg::LoadPicture(CString strFile)
{
	int m_nPictureSize = 170;
	CBitmap* pBitmap = NULL;
	HBITMAP hBitmap = (HBITMAP)::LoadImage(NULL, strFile, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
	if(NULL != hBitmap)
	{
		CBitmap Bitmap, MemBitmap;
		Bitmap.Attach((HBITMAP)hBitmap);
		// rescale CBItmap ....
		// retrieve the final bitmap
		CBitmap* pFinalBitmap = MemDC.SelectObject(pOldBitmap);
		SourceDC.SelectObject(pOldBmp);
		pBitmap = new CBitmap;
		pBitmap->Attach((HBITMAP)pFinalBitmap->GetSafeHandle());
BITMAP bm3;
pBitmap->GetBitmap(&bm3);
TRACE("Width and height INSIDE if condition: %d|%d\n", bm3.bmWidth, bm3.bmHeight);
	}
BITMAP bm4;
pBitmap->GetBitmap(&bm4);
TRACE("Width and height OUTSIDE if condition: %d|%d\n", bm4.bmWidth, bm4.bmHeight);
	return pBitmap;
}

I want to use this method in order to add this created CBitmap pointer to add them into CTypedCBitmapList:
CBitmap* pImage = LoadPicture(strPath);
if(NULL == pImage->GetSafeHandle())
    return 0;
m_PtrArrayBitmap.Add(pImage);

Ok, but the strange thing is that pBitmap from inside of LoadPicture method has correct size inside of 'if' condition, and wrong size outside of 'if' condition:
Width and height INSIDE if condition: 170|170
Width and height OUTSIDE if condition: -858993460|-858993460

Why ? It is not the same pBitmap object ? Could you help me ? Kindly thank for any further help !
SuggestionRe: Returning CBitmap* pointer Pin
Richard MacCutchan18-Nov-15 21:40
mveRichard MacCutchan18-Nov-15 21:40 
GeneralRe: Returning CBitmap* pointer Pin
_Flaviu19-Nov-15 0:20
Member_Flaviu19-Nov-15 0:20 
GeneralRe: Returning CBitmap* pointer Pin
Richard MacCutchan19-Nov-15 1:43
mveRichard MacCutchan19-Nov-15 1:43 
QuestionC++ Pin
Member 1215089418-Nov-15 11:38
MemberMember 1215089418-Nov-15 11:38 
AnswerRe: C++ Pin
Richard Andrew x6418-Nov-15 12:00
professionalRichard Andrew x6418-Nov-15 12:00 
GeneralRe: C++ Pin
Member 1215089418-Nov-15 12:06
MemberMember 1215089418-Nov-15 12:06 
AnswerRe: C++ Pin
CPallini18-Nov-15 21:52
mveCPallini18-Nov-15 21:52 
AnswerRe: C++ Pin
Jochen Arndt18-Nov-15 22:54
professionalJochen Arndt18-Nov-15 22:54 
AnswerRe: C++ Pin
«_Superman_»29-Nov-15 19:08
professional«_Superman_»29-Nov-15 19:08 
QuestionChange printed background color, how? Pin
Tom Stokes17-Nov-15 14:53
MemberTom Stokes17-Nov-15 14:53 
AnswerRe: Change printed background color, how? Pin
Richard MacCutchan17-Nov-15 21:54
mveRichard MacCutchan17-Nov-15 21:54 
GeneralRe: Change printed background color, how? Pin
Tom Stokes18-Nov-15 13:48
MemberTom Stokes18-Nov-15 13:48 
Questionhelp creating a COM/ATL wrapper for a USB Scanner for VB6 Pin
E Wolf16-Nov-15 6:00
MemberE Wolf16-Nov-15 6:00 
SuggestionRe: help creating a COM/ATL wrapper for a USB Scanner for VB6 Pin
Richard MacCutchan16-Nov-15 7:25
mveRichard MacCutchan16-Nov-15 7:25 
QuestionCapture Screen whenever the display is updated Pin
Vijjuuu.16-Nov-15 0:17
MemberVijjuuu.16-Nov-15 0:17 
AnswerRe: Capture Screen whenever the display is updated Pin
John Torjo16-Nov-15 0:39
professionalJohn Torjo16-Nov-15 0:39 
GeneralA Data Structures Book Needed Pin
Amr.Mohammad8715-Nov-15 14:14
MemberAmr.Mohammad8715-Nov-15 14:14 
QuestionRe: A Data Structures Book Needed Pin
David Crow16-Nov-15 2:45
MemberDavid Crow16-Nov-15 2:45 

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.