Thread: opening an html file to IE, c++

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    10

    opening an html file to IE, c++

    how would i open a html file so that it opens in IE?

    i need it for an autorun program.

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    223
    The following sample opens the indicater file by strDir in the default browser....this works with the current directory but you can place any value you want to replace strDir....


    Code:
    void CAboutDlg::OnButton1() 
    {
    	CString strDir;
    	char buffer[255];
    
    	GetCurrentDirectory(255, buffer);
    
    	strDir = buffer;
    	
    	strDir.TrimRight("\\");
    	strDir += "\\";
    	strDir += _T("helpindex.html");
    
    	if( 32 >= (int)ShellExecute( NULL, "open", strDir, NULL, NULL, SW_SHOWNORMAL))
    	{
    		AfxMessageBox("::ShellExecuteFailed"
    			 " to open this link!");
    	}	
    }
    zMan

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  2. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 03:53 AM
  3. Simple File encryption
    By caroundw5h in forum C Programming
    Replies: 2
    Last Post: 10-13-2004, 10:51 PM
  4. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM