Click here to Skip to main content
15,921,203 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CRichEditCtrl Font related query [modified] Pin
Mahesh Kulkarni6-Oct-06 22:40
Mahesh Kulkarni6-Oct-06 22:40 
GeneralRe: CRichEditCtrl Font related query Pin
harsha_12346-Oct-06 23:15
harsha_12346-Oct-06 23:15 
GeneralRe: CRichEditCtrl Font related query Pin
Mahesh Kulkarni6-Oct-06 23:26
Mahesh Kulkarni6-Oct-06 23:26 
GeneralRe: CRichEditCtrl Font related query Pin
harsha_12347-Oct-06 0:17
harsha_12347-Oct-06 0:17 
GeneralRe: CRichEditCtrl Font related query Pin
Mahesh Kulkarni7-Oct-06 0:49
Mahesh Kulkarni7-Oct-06 0:49 
GeneralRe: CRichEditCtrl Font related query Pin
harsha_12347-Oct-06 2:05
harsha_12347-Oct-06 2:05 
GeneralRe: CRichEditCtrl Font related query Pin
harsha_12347-Oct-06 2:27
harsha_12347-Oct-06 2:27 
QuestionDetecting Connection Breakdown Pin
vijay_aroli6-Oct-06 21:21
vijay_aroli6-Oct-06 21:21 
QuestionClient Window Position Pin
HakunaMatada6-Oct-06 20:46
HakunaMatada6-Oct-06 20:46 
AnswerRe: Client Window Position Pin
Stephen Hewitt6-Oct-06 20:51
Stephen Hewitt6-Oct-06 20:51 
GeneralRe: Client Window Position Pin
HakunaMatada6-Oct-06 20:55
HakunaMatada6-Oct-06 20:55 
Questionhow to show 24 color icon in system tray? Pin
ikohl6-Oct-06 19:49
ikohl6-Oct-06 19:49 
Answermy os is win2000, perhaps 24 color can only be applied in winxp Pin
ikohl6-Oct-06 19:52
ikohl6-Oct-06 19:52 
Generalit's ok now if download a patch for Explorer.exe, this is the address Pin
ikohl6-Oct-06 20:18
ikohl6-Oct-06 20:18 
Question3D coloured button Pin
sarojkumarjena6-Oct-06 18:14
sarojkumarjena6-Oct-06 18:14 
AnswerRe: 3D coloured button Pin
Hamid_RT6-Oct-06 19:09
Hamid_RT6-Oct-06 19:09 
QuestionHow do I use string as a param for CreateWindowEx function Pin
scody6-Oct-06 18:14
scody6-Oct-06 18:14 
AnswerRe: How do I use string as a param for CreateWindowEx function Pin
Michael Dunn6-Oct-06 18:56
sitebuilderMichael Dunn6-Oct-06 18:56 
AnswerRe: How do I use string as a param for CreateWindowEx function Pin
Hamid_RT6-Oct-06 19:00
Hamid_RT6-Oct-06 19:00 
AnswerRe: How do I use string as a param for CreateWindowEx function Pin
scody7-Oct-06 1:18
scody7-Oct-06 1:18 
QuestionTemporary pointer Pin
Oliver1236-Oct-06 16:18
Oliver1236-Oct-06 16:18 
AnswerRe: Temporary pointer Pin
Michael Dunn6-Oct-06 18:59
sitebuilderMichael Dunn6-Oct-06 18:59 
QuestionCan't get a file path from a windows dialog and pass it too a directX api call Pin
BarryOg6-Oct-06 14:11
BarryOg6-Oct-06 14:11 
I'm trying to open a dialog box to the user and than take the filename they select and pass it too a DirectX api call which gets details about that file. I've been messing around with this for a few nights and I've got absolutely nowhere. I've read a lot about character encoding and although there are still a few blanks in my understanding I have a fairly good grasp of it. I'd imagine what I'm trying to do is simple enough and I'm running into pitfalls which are common place but no matter what I attempt to do I can't seem to get around these errors. Anyway here's my code, please take a look and if you could shed some light you'd really be doing me a huge favour.

I was given this in an earlier forum post, I really don't understand what it does, but it fixed an eariler problem I had so its in there for now.

#ifdef _UNICODE<br />
typedef wstring tstring;<br />
#else<br />
typedef string tstring;<br />
#endif


This is my function to display a file select dialog box and returns a tstring of the full path.

tstring openFile()<br />
{<br />
	OPENFILENAME ofn;       // common dialog box structure<br />
	TCHAR szFile[_MAX_PATH];       // buffer for file name<br />
	HANDLE test;<br />
<br />
	// Initialize OPENFILENAME<br />
	ZeroMemory(&ofn, sizeof(ofn));<br />
	ofn.lStructSize = sizeof(ofn);<br />
	ofn.hwndOwner = mainLoop.hWnd;<br />
	ofn.lpstrFile = szFile;<br />
	//<br />
	// Set lpstrFile[0] to '\0' so that GetOpenFileName does not <br />
	// use the contents of szFile to initialize itself.<br />
	//<br />
	ofn.lpstrFile[0] = '\0';<br />
	ofn.nMaxFile = sizeof(szFile);<br />
	ofn.lpstrFilter = _T("All\0*.*\0Text\0*.TXT\0");<br />
	ofn.nFilterIndex = 1;<br />
	ofn.lpstrFileTitle = NULL;<br />
	ofn.nMaxFileTitle = 0;<br />
	ofn.lpstrInitialDir = NULL;<br />
	ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;<br />
<br />
	// Display the Open dialog box. <br />
<br />
	if (GetOpenFileName(&ofn)==TRUE) <br />
		test = CreateFile(ofn.lpstrFile, GENERIC_READ,<br />
			0, (LPSECURITY_ATTRIBUTES) NULL,<br />
			OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,<br />
			(HANDLE) NULL);<br />
	<br />
<br />
<br />
	tstring temp (ofn.lpstrFile);<br />
<br />
	return temp;<br />
<br />
}


When I call this the contents of Info remain null, so I'm guessing what's happening here is the encoding of fileName is incorrect for this function.

fileName = openFile();<br />
	<br />
D3DXGetImageInfoFromFile(fileName.c_str(), &Info);


If I call it with the value hardcoded like so:

D3DXGetImageInfoFromFile(_T("F:\\Pictures\\ShannonTrip2006-PrintRun\\ShannonTrip2006 326.jpg"))

it works, it also works if I do the following:

fileName = _T("F:\\Pictures\\ShannonTrip2006-PrintRun\\ShannonTrip2006 326.jpg");<br />
	<br />
D3DXGetImageInfoFromFile(fileName.c_str(), &Info);


The memory of fileName in this call looks exactly the same as the memory used when I'm getting the value from openFile() yet one works and the other doesn't. Not sure where I can look after this, any help is greatly appreciated.
AnswerRe: Can't get a file path from a windows dialog and pass it too a directX api call Pin
Hamid_RT6-Oct-06 19:20
Hamid_RT6-Oct-06 19:20 
GeneralRe: Can't get a file path from a windows dialog and pass it too a directX api call Pin
BarryOg7-Oct-06 1:38
BarryOg7-Oct-06 1:38 

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.