CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2002
    Posts
    35

    How can i open a file in notepad from MFC dialog based application

    How can i open a file in notepad from MFC dialog based application

  2. #2
    Hi Sir,
    Try the following code:
    CString strFile;
    strFile = "c:\\temp\\readme.txt";

    ShellExecute(NULL,
    "open",
    strFile,
    NULL,NULL,
    SW_SHOW);
    Andy
    --------------------------------------------------------
    http://www.********.net
    XD++ MFC Library provides Microsoft Foundation Class (MFC)/Visual C++ developers with a complete library of MFC extension classes which implement a drag and drop (e.g. VC,VB Form Editor) graphical interface.

  3. #3
    Join Date
    Apr 2003
    Posts
    1,755

    Smile

    Code:
    ShellExecute(NULL, "open", "NOTEPAD MYTEXT.TXT",  NULL, NULL, SW_SHOW);
    Hope this will help you.

  4. #4
    Join Date
    Apr 2002
    Posts
    35

    it doesnt display the notepad with file

    thanks for the reply but
    it doesnt display the notepad with file

  5. #5
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Take a look at this FAQ...

  6. #6
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871
    Try using:
    Code:
    ShellExecute(NULL, "open", "NOTEPAD","MYTEXT.TXT", NULL, SW_SHOW);
    Where 'MYTEXT.TXT" is agument to notepad. You may need to pass full path of the file.
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  7. #7
    Join Date
    Apr 2002
    Posts
    35
    thanx it worked

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured