Display web page

This is a discussion on Display web page within the Windows Programming forums, part of the Platform Specific Boards category; How can I display a web page in c++. (DevC++, WinXP Pro SP2) I want to be able to read ...

  1. #1
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318

    Display web page

    How can I display a web page in c++. (DevC++, WinXP Pro SP2)
    I want to be able to read or modify the source code before showing the page and refreshing and some else good functions webbrowers have.

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    ShellExecuteEx?
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,265
    How in the world would ShellExecuteEx accomplish this??

    maxorator >> Look into using the IExplorer ActiveX control.

  4. #4
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    filestreams to create the page, save to file, ShellExecuteEx to launch it. Set the lpFile argument to the filename. If you want to keep running the program while it's open set the SEE_MASK_NOCLOSEPROCESS flag.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  5. #5
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,265
    Except that will not satisfy his requirements. Your method will only work for a single page. It will not handle user navigation or page refreshing.

  6. #6
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    I found this code somewhere:
    Code:
    #include <windows.h>
    #include <Urlmon.h>
    typedef HRESULT STDAPICALLTYPE SHOWHTMLDIALOGFN (HWND hwndParent, IMoniker *pmk, VARIANT *pvarArgIn, WCHAR* pchOptions, VARIANT *pvArgOut);
    int main() {
      SHOWHTMLDIALOGFN* pfnShowHTMLDialog;
      HINSTANCE hinstMSHTML = LoadLibrary(TEXT("MSHTML.DLL"));
    
       if (hinstMSHTML == NULL)
       {
           // Error loading module -- fail as securely as possible
           return 0;
       }
       
       pfnShowHTMLDialog = (SHOWHTMLDIALOGFN*)GetProcAddress(hinstMSHTML,
                                                                  TEXT("ShowHTMLDialog"));
       if (pfnShowHTMLDialog)
       {
           IMoniker *pURLMoniker;
           BSTR bstrURL = SysAllocString(L"http://www.example.com");
           CreateURLMoniker(NULL, bstrURL, &pURLMoniker);
    
           if (pURLMoniker)
           {
               (*pfnShowHTMLDialog)(NULL, pURLMoniker, NULL, NULL, NULL);
               pURLMoniker->Release(); 
           }
    
           SysFreeString(bstrURL);
       }
    
       FreeLibrary(hinstMSHTML);
    
      return 0;
    }
    But here I can't even design or change the size of the window the page is in and I don't know how I can get html code before it shows the page and looks like I can't even refresh. And if I try to navigate, press a link for example, it opens a new IE window.
    Last edited by maxorator; 03-02-2006 at 11:49 PM.

  7. #7
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    My compiler doesn't the Urlmon.h or it's library, where can I download them?

  8. #8
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Search filewatcher.org for urlmon.lib and urlmon.h.
    You must understand which version you need by yourself...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Partial web page downloading
    By god_of_war in forum C++ Programming
    Replies: 12
    Last Post: 08-14-2006, 01:19 PM
  2. Opening a web page
    By charon12 in forum C++ Programming
    Replies: 1
    Last Post: 08-24-2004, 02:17 AM
  3. Web Page Organization
    By Khelder in forum C# Programming
    Replies: 4
    Last Post: 05-06-2004, 11:24 AM
  4. Opening a web page
    By phantom in forum C++ Programming
    Replies: 8
    Last Post: 04-10-2004, 04:53 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21