Click here to Skip to main content
12,820,283 members (30,125 online)

C / C++ / MFC

 
GeneralRe: How to get Visual C++ to use the char* forms of standard functions? Pin
Anthony Appleyard19-Jan-13 13:06
memberAnthony Appleyard19-Jan-13 13:06 
QuestionFor beginners introduction to CFormView, CView ? Pin
bosfan18-Jan-13 12:04
memberbosfan18-Jan-13 12:04 
AnswerRe: For beginners introduction to CFormView, CView ? Pin
jibesh18-Jan-13 14:36
memberjibesh18-Jan-13 14:36 
GeneralRe: For beginners introduction to CFormView, CView ? Pin
bosfan18-Jan-13 23:51
memberbosfan18-Jan-13 23:51 
AnswerRe: For beginners introduction to CFormView, CView ? Pin
SajeeshCheviry19-Jan-13 2:28
memberSajeeshCheviry19-Jan-13 2:28 
GeneralRe: For beginners introduction to CFormView, CView ? Pin
bosfan19-Jan-13 5:38
memberbosfan19-Jan-13 5:38 
GeneralRe: For beginners introduction to CFormView, CView ? Pin
SajeeshCheviry19-Jan-13 8:37
memberSajeeshCheviry19-Jan-13 8:37 
QuestionUsing the OpenFileDialog in Console? Pin
Member 975216818-Jan-13 8:01
memberMember 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? Pin
jeron118-Jan-13 8:32
memberjeron118-Jan-13 8:32 
AnswerRe: Using the OpenFileDialog in Console? Pin
Member 975216818-Jan-13 8:38
memberMember 975216818-Jan-13 8:38 
GeneralRe: Using the OpenFileDialog in Console? Pin
jeron118-Jan-13 9:07
memberjeron118-Jan-13 9:07 
SuggestionRe: Using the OpenFileDialog in Console? Pin
Member 975216818-Jan-13 9:33
memberMember 975216818-Jan-13 9:33 
QuestionHELP: how to load satellite DLL for a DLL Pin
andwan018-Jan-13 6:54
memberandwan018-Jan-13 6:54 
AnswerRe: HELP: how to load satellite DLL for a DLL Pin
andwan021-Jan-13 23:46
memberandwan021-Jan-13 23:46 
QuestionCompiling libexif 0.6.21 Pin
Sharath C V17-Jan-13 19:19
memberSharath C V17-Jan-13 19:19 
AnswerRe: Compiling libexif 0.6.21 Pin
CPallini17-Jan-13 22:55
mvpCPallini17-Jan-13 22:55 
GeneralRe: Compiling libexif 0.6.21 Pin
Sharath C V18-Jan-13 16:51
memberSharath C V18-Jan-13 16:51 
GeneralRe: Compiling libexif 0.6.21 Pin
CPallini19-Jan-13 0:18
mvpCPallini19-Jan-13 0:18 
AnswerRe: Compiling libexif 0.6.21 Pin
Graham Breach17-Jan-13 23:41
memberGraham Breach17-Jan-13 23:41 
GeneralRe: Compiling libexif 0.6.21 Pin
Sharath C V18-Jan-13 16:49
memberSharath C V18-Jan-13 16:49 
QuestionNeed Debugging tips: MFC static library DLL Pin
Clark Kent12317-Jan-13 9:06
memberClark Kent12317-Jan-13 9:06 
AnswerRe: Need Debugging tips: MFC static library DLL Pin
Richard MacCutchan18-Jan-13 0:07
mvpRichard MacCutchan18-Jan-13 0:07 
QuestionRe: Need Debugging tips: MFC static library DLL Pin
Clark Kent12318-Jan-13 4:03
memberClark Kent12318-Jan-13 4:03 
AnswerRe: Need Debugging tips: MFC static library DLL Pin
David Knechtges18-Jan-13 4:43
memberDavid Knechtges18-Jan-13 4:43 
GeneralRe: Need Debugging tips: MFC static library DLL Pin
Clark Kent12318-Jan-13 5:19
memberClark Kent12318-Jan-13 5:19 

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.


Advertise | Privacy | Mobile
Web01 | 2.8.170308.1 | Last Updated 25 Mar 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid