Click here to Skip to main content
11,584,460 members (62,368 online)

C / C++ / MFC

 
GeneralRe: How to get Visual C++ to use the char* forms of standard functions? Pin
Anthony Appleyard19-Jan-13 12:06
memberAnthony Appleyard19-Jan-13 12:06 
QuestionFor beginners introduction to CFormView, CView ? Pin
bosfan18-Jan-13 11:04
memberbosfan18-Jan-13 11:04 
AnswerRe: For beginners introduction to CFormView, CView ? Pin
jibesh18-Jan-13 13:36
memberjibesh18-Jan-13 13:36 
GeneralRe: For beginners introduction to CFormView, CView ? Pin
bosfan18-Jan-13 22:51
memberbosfan18-Jan-13 22:51 
AnswerRe: For beginners introduction to CFormView, CView ? Pin
SajeeshCheviry19-Jan-13 1:28
memberSajeeshCheviry19-Jan-13 1:28 
GeneralRe: For beginners introduction to CFormView, CView ? Pin
bosfan19-Jan-13 4:38
memberbosfan19-Jan-13 4:38 
GeneralRe: For beginners introduction to CFormView, CView ? Pin
SajeeshCheviry19-Jan-13 7:37
memberSajeeshCheviry19-Jan-13 7:37 
QuestionUsing the OpenFileDialog in Console? Pin
Member 975216818-Jan-13 7:01
memberMember 975216818-Jan-13 7:01 
Hello.

I just wrote a code in C++. It should calculate something but for it we need a external File. Now I have to type in the whole Path. That's annoying.
Is there a possibility to open an "openfiledialog"?

Now I have this code copied but it won't work-.-:
	OPENFILENAME ofn;       // common dialog box structure
	char szFile[1000];       // buffer for file name
	HWND hwnd = GetConsoleWindow();              // owner window
	HANDLE hf;              // file handle

	//Initialize OPENFILENAME
	ZeroMemory(&ofn, sizeof(ofn));
	ofn.lStructSize = sizeof(ofn);
	ofn.hwndOwner = hwnd;
	ofn.lpstrFile = szFile;
	ofn.nMaxFile = sizeof(szFile);
	ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0";
	ofn.nFilterIndex = 1;
	ofn.lpstrFileTitle = NULL;
	ofn.nMaxFileTitle = 0;
	ofn.lpstrInitialDir = NULL;
	ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
 
	// Display the Open dialog box. 

	if (GetOpenFileName(&ofn)==TRUE) 
		hf = CreateFile(ofn.lpstrFile, GENERIC_READ,
			0, (LPSECURITY_ATTRIBUTES) NULL,
			OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
			(HANDLE) NULL);

Can you see there any mistakes or can you post a better code for it?
Is there even a possibility for it, but without using MFC or .NET?

Greets

PS: Sorry for my bad english. I'm from Germany.

modified 18-Jan-13 13:39pm.

QuestionRe: Using the OpenFileDialog in Console? Pin
jeron118-Jan-13 7:32
memberjeron118-Jan-13 7:32 
AnswerRe: Using the OpenFileDialog in Console? Pin
Member 975216818-Jan-13 7:38
memberMember 975216818-Jan-13 7:38 
GeneralRe: Using the OpenFileDialog in Console? Pin
jeron118-Jan-13 8:07
memberjeron118-Jan-13 8:07 
SuggestionRe: Using the OpenFileDialog in Console? Pin
Member 975216818-Jan-13 8:33
memberMember 975216818-Jan-13 8:33 
QuestionHELP: how to load satellite DLL for a DLL Pin
andwan018-Jan-13 5:54
memberandwan018-Jan-13 5:54 
AnswerRe: HELP: how to load satellite DLL for a DLL Pin
andwan021-Jan-13 22:46
memberandwan021-Jan-13 22:46 
QuestionCompiling libexif 0.6.21 Pin
Sharath C V17-Jan-13 18:19
memberSharath C V17-Jan-13 18:19 
AnswerRe: Compiling libexif 0.6.21 Pin
CPallini17-Jan-13 21:55
mvpCPallini17-Jan-13 21:55 
GeneralRe: Compiling libexif 0.6.21 Pin
Sharath C V18-Jan-13 15:51
memberSharath C V18-Jan-13 15:51 
GeneralRe: Compiling libexif 0.6.21 Pin
CPallini18-Jan-13 23:18
mvpCPallini18-Jan-13 23:18 
AnswerRe: Compiling libexif 0.6.21 Pin
Graham Breach17-Jan-13 22:41
memberGraham Breach17-Jan-13 22:41 
GeneralRe: Compiling libexif 0.6.21 Pin
Sharath C V18-Jan-13 15:49
memberSharath C V18-Jan-13 15:49 
QuestionNeed Debugging tips: MFC static library DLL Pin
Clark Kent12317-Jan-13 8:06
memberClark Kent12317-Jan-13 8:06 
AnswerRe: Need Debugging tips: MFC static library DLL Pin
Richard MacCutchan17-Jan-13 23:07
mvpRichard MacCutchan17-Jan-13 23:07 
QuestionRe: Need Debugging tips: MFC static library DLL Pin
Clark Kent12318-Jan-13 3:03
memberClark Kent12318-Jan-13 3:03 
AnswerRe: Need Debugging tips: MFC static library DLL Pin
David Knechtges18-Jan-13 3:43
memberDavid Knechtges18-Jan-13 3:43 
GeneralRe: Need Debugging tips: MFC static library DLL Pin
Clark Kent12318-Jan-13 4:19
memberClark Kent12318-Jan-13 4:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.8.150707.1 | Last Updated 7 Jul 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid