Click here to Skip to main content
15,891,136 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionhow to display a bitmap which have 24 colors Pin
tfzxyinhao13-Nov-09 23:05
tfzxyinhao13-Nov-09 23:05 
AnswerRe: how to display a bitmap which have 24 colors Pin
Hadi Dayvary14-Nov-09 1:02
professionalHadi Dayvary14-Nov-09 1:02 
GeneralRe: how to display a bitmap which have 24 colors Pin
tfzxyinhao14-Nov-09 2:14
tfzxyinhao14-Nov-09 2:14 
GeneralRe: how to display a bitmap which have 24 colors Pin
Hadi Dayvary14-Nov-09 2:26
professionalHadi Dayvary14-Nov-09 2:26 
GeneralRe: how to display a bitmap which have 24 colors Pin
tfzxyinhao14-Nov-09 3:00
tfzxyinhao14-Nov-09 3:00 
GeneralRe: how to display a bitmap which have 24 colors Pin
Hadi Dayvary14-Nov-09 3:26
professionalHadi Dayvary14-Nov-09 3:26 
GeneralRe: how to display a bitmap which have 24 colors Pin
jianzhuhuai18-Nov-09 2:38
jianzhuhuai18-Nov-09 2:38 
QuestionWhen is "bmp" not equal to "bmp"? Pin
Sauce!13-Nov-09 20:34
Sauce!13-Nov-09 20:34 
Okay so long story short I'm doing some string manipulation in order to determine the file format the user would like to save an image as in DirectX. Simple enough.

bool saveToFile(const std::tstring &path)
{
	size_t pos = path.find_last_of(_T('.'));
	std::tstring extension = path.substr(pos + 1);

	D3DXIMAGE_FILEFORMAT fmt;
	if(extension == _T("bmp"))
	{
		fmt = D3DXIFF_BMP;
	}
	else if(extension == _T("png"))
	{
		fmt = D3DXIFF_PNG;
	}
	else if(extension == _T("tga"))
	{
		fmt = D3DXIFF_TGA;
	}
	else
	{
		return false;
	}
	
	//Save file.

	return true;
}


Problem is, upon debugging this code (scratching my head at why no image is being saved!) I come to the realisation that the test for the extension being "bmp" falls through every time. I've checked the contents of extension and sure enough, it's "bmp" - so why is the test falling through?

I'm fairly certain it's got something to do with std::tstring, which is simply defined like so:

namespace std
{
	typedef basic_string< TCHAR >  tstring;
}


Any ideas?
AnswerRe: When is "bmp" not equal to "bmp"? Pin
«_Superman_»14-Nov-09 9:28
professional«_Superman_»14-Nov-09 9:28 
GeneralRe: When is "bmp" not equal to "bmp"? Pin
Sauce!14-Nov-09 13:08
Sauce!14-Nov-09 13:08 
QuestionVertical Text in OnDraw() Pin
Anu_Bala13-Nov-09 20:14
Anu_Bala13-Nov-09 20:14 
AnswerRe: Vertical Text in OnDraw() Pin
Hadi Dayvary13-Nov-09 22:02
professionalHadi Dayvary13-Nov-09 22:02 
QuestionHow to suspended other program's Main Window? Pin
wangningyu13-Nov-09 16:47
wangningyu13-Nov-09 16:47 
AnswerRe: How to suspended other program's Main Window? Pin
enhzflep14-Nov-09 13:20
enhzflep14-Nov-09 13:20 
QuestionSet Dynamic content on webbrowser control Pin
Arnon A13-Nov-09 10:35
Arnon A13-Nov-09 10:35 
QuestionLNK2019 error, unresolved external symbol __thiscall Pin
Dan Senior13-Nov-09 10:15
Dan Senior13-Nov-09 10:15 
AnswerRe: LNK2019 error, unresolved external symbol __thiscall Pin
Garth J Lancaster13-Nov-09 11:29
professionalGarth J Lancaster13-Nov-09 11:29 
GeneralRe: LNK2019 error, unresolved external symbol __thiscall Pin
Dan Senior23-Nov-09 11:25
Dan Senior23-Nov-09 11:25 
GeneralRe: LNK2019 error, unresolved external symbol __thiscall Pin
Garth J Lancaster23-Nov-09 11:54
professionalGarth J Lancaster23-Nov-09 11:54 
QuestionHow to read text from a status bar (CStatus) of another application ? Pin
hongheo7613-Nov-09 10:14
hongheo7613-Nov-09 10:14 
AnswerRe: How to read text from a status bar (CStatus) of another application ? Pin
Hadi Dayvary13-Nov-09 22:05
professionalHadi Dayvary13-Nov-09 22:05 
GeneralRe: How to read text from a status bar (CStatus) of another application ? Pin
hongheo7614-Nov-09 4:20
hongheo7614-Nov-09 4:20 
GeneralRe: How to read text from a status bar (CStatus) of another application ? Pin
Hadi Dayvary14-Nov-09 4:32
professionalHadi Dayvary14-Nov-09 4:32 
GeneralRe: How to read text from a status bar (CStatus) of another application ? Pin
hongheo7614-Nov-09 4:38
hongheo7614-Nov-09 4:38 
Questionre:Using waitformultipleobjects? Pin
Alan Kurlansky13-Nov-09 8:56
Alan Kurlansky13-Nov-09 8:56 

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.