Click here to Skip to main content
       

C / C++ / MFC

 
AnswerRe: Writing a non-Windows program PinmvpRichard MacCutchan19-Jan-13 2:35 
QuestionHow to get Visual C++ to use the char* forms of standard functions? PinmemberAnthony Appleyard19-Jan-13 2:15 
AnswerRe: How to get Visual C++ to use the char* forms of standard functions? PinmemberSajeeshCheviry19-Jan-13 2:29 
GeneralRe: How to get Visual C++ to use the char* forms of standard functions? PinmvpRichard MacCutchan19-Jan-13 2:34 
AnswerRe: How to get Visual C++ to use the char* forms of standard functions? PinmvpRichard MacCutchan19-Jan-13 2:33 
GeneralRe: How to get Visual C++ to use the char* forms of standard functions? PinmemberSajeeshCheviry19-Jan-13 2:37 
GeneralRe: How to get Visual C++ to use the char* forms of standard functions? PinmemberAnthony Appleyard19-Jan-13 13:06 
QuestionFor beginners introduction to CFormView, CView ? Pinmemberbosfan18-Jan-13 12:04 
AnswerRe: For beginners introduction to CFormView, CView ? Pinmemberjibesh18-Jan-13 14:36 
GeneralRe: For beginners introduction to CFormView, CView ? Pinmemberbosfan18-Jan-13 23:51 
AnswerRe: For beginners introduction to CFormView, CView ? PinmemberSajeeshCheviry19-Jan-13 2:28 
GeneralRe: For beginners introduction to CFormView, CView ? Pinmemberbosfan19-Jan-13 5:38 
GeneralRe: For beginners introduction to CFormView, CView ? PinmemberSajeeshCheviry19-Jan-13 8:37 
QuestionUsing the OpenFileDialog in Console? [modified] PinmemberMember 975216818-Jan-13 8: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? Pinmemberjeron118-Jan-13 8:32 
AnswerRe: Using the OpenFileDialog in Console? PinmemberMember 975216818-Jan-13 8:38 
GeneralRe: Using the OpenFileDialog in Console? Pinmemberjeron118-Jan-13 9:07 
SuggestionRe: Using the OpenFileDialog in Console? PinmemberMember 975216818-Jan-13 9:33 
QuestionHELP: how to load satellite DLL for a DLL Pinmemberandwan018-Jan-13 6:54 
AnswerRe: HELP: how to load satellite DLL for a DLL Pinmemberandwan021-Jan-13 23:46 
QuestionCompiling libexif 0.6.21 PinmemberSharath C V17-Jan-13 19:19 
AnswerRe: Compiling libexif 0.6.21 PinmvpCPallini17-Jan-13 22:55 
GeneralRe: Compiling libexif 0.6.21 PinmemberSharath C V18-Jan-13 16:51 
GeneralRe: Compiling libexif 0.6.21 PinmvpCPallini19-Jan-13 0:18 
AnswerRe: Compiling libexif 0.6.21 PinmemberGraham Breach17-Jan-13 23:41 
GeneralRe: Compiling libexif 0.6.21 PinmemberSharath C V18-Jan-13 16:49 
QuestionNeed Debugging tips: MFC static library DLL PinmemberClark Kent12317-Jan-13 9:06 
AnswerRe: Need Debugging tips: MFC static library DLL PinmvpRichard MacCutchan18-Jan-13 0:07 
QuestionRe: Need Debugging tips: MFC static library DLL PinmemberClark Kent12318-Jan-13 4:03 
AnswerRe: Need Debugging tips: MFC static library DLL PinmemberDavid Knechtges18-Jan-13 4:43 
GeneralRe: Need Debugging tips: MFC static library DLL PinmemberClark Kent12318-Jan-13 5:19 
AnswerRe: Need Debugging tips: MFC static library DLL PinmvpRichard MacCutchan18-Jan-13 5:11 
GeneralRe: Need Debugging tips: MFC static library DLL PinmemberClark Kent12318-Jan-13 5:18 
GeneralRe: Need Debugging tips: MFC static library DLL PinmvpRichard MacCutchan18-Jan-13 5:23 
GeneralRe: Need Debugging tips: MFC static library DLL PinmemberClark Kent12318-Jan-13 5:32 
AnswerRe: Need Debugging tips: MFC static library DLL PinmemberAlan Balkany18-Jan-13 6:21 
QuestionHow to detect USB Device and sends data Pinmemberyogeshs16-Jan-13 22:24 
AnswerRe: How to detect USB Device and sends data Pinmember«_Superman_»16-Jan-13 22:54 
GeneralRe: How to detect USB Device and sends data Pinmemberyogeshs17-Jan-13 0:05 
GeneralRe: How to detect USB Device and sends data PinmemberJochen Arndt17-Jan-13 1:49 
AnswerRe: How to detect USB Device and sends data PinmemberDean M. Sands, III17-Jan-13 4:09 
AnswerRe: How to detect USB Device and sends data PinmemberErudite_Eric18-Jan-13 1:22 
QuestionMFC architecture Pinmembershanmugarajaa16-Jan-13 19:37 
AnswerRe: MFC architecture Pinmembersujayg16-Jan-13 19:49 
AnswerRe: MFC architecture Pinmember«_Superman_»16-Jan-13 22:56 
AnswerRe: MFC architecture PinmemberAlan Balkany17-Jan-13 6:14 
AnswerRe: MFC architecture PinmemberMaximilien17-Jan-13 10:29 
GeneralRe: MFC architecture Pinmembersujayg17-Jan-13 19:54 
GeneralRe: MFC architecture PinmemberMaximilien18-Jan-13 2:26 
QuestionHow does GDI+ decide which to use, alphablending or dithering? PinmemberCode-o-mat16-Jan-13 11:49 

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
Web02 | 2.8.141220.1 | Last Updated 21 Dec 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid