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.
Printable View
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.
ShellExecuteEx?
How in the world would ShellExecuteEx accomplish this??
maxorator >> Look into using the IExplorer ActiveX control.
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.
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.
I found this code somewhere:
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.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;
}
My compiler doesn't the Urlmon.h or it's library, where can I download them?
Search filewatcher.org for urlmon.lib and urlmon.h.
You must understand which version you need by yourself...