Click here to Skip to main content
15,887,343 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Trying to port libcddb to MSVC, having issues... Pin
Richard MacCutchan20-Nov-15 3:02
mveRichard MacCutchan20-Nov-15 3:02 
GeneralRe: Trying to port libcddb to MSVC, having issues... Pin
Jochen Arndt20-Nov-15 3:06
professionalJochen Arndt20-Nov-15 3:06 
GeneralRe: Trying to port libcddb to MSVC, having issues... Pin
Richard MacCutchan20-Nov-15 3:03
mveRichard MacCutchan20-Nov-15 3:03 
QuestionSTL list member function(S) Pin
Amr.Mohammad8719-Nov-15 7:05
Amr.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
Amr.Mohammad8719-Nov-15 12:47 
GeneralRe: STL list member function(S) Pin
CPallini19-Nov-15 21:26
mveCPallini19-Nov-15 21:26 
QuestionReturning CBitmap* pointer Pin
_Flaviu18-Nov-15 20:15
_Flaviu18-Nov-15 20:15 
I have wrote a method that load and rescale a CBitmap:
C++
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:
C++
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:
C++
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
_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
Member 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
Member 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
Tom 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
Tom Stokes18-Nov-15 13:48 
Questionhelp creating a COM/ATL wrapper for a USB Scanner for VB6 Pin
E Wolf16-Nov-15 6:00
E 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
Vijjuuu.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
Amr.Mohammad8715-Nov-15 14:14 

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.