A
A
a_shestov2018-03-31 12:35:11
HTML
a_shestov, 2018-03-31 12:35:11

How to use the built-in web browser in Visual Studio in c++ forms projects?

In my project, I use the standard web browser built into Visual Studio 2015. It has a URL definition as input parameters in the form:
webbrowser->URL = (gcnew System::URIs(L" something ", System::UriKind::Absolute));
It is necessary to open a local .htm page located in the folder with the executable file, i.e. path to the executable file:
/program/Run.exe
path to the page:
/program/HTML_page.htm
When a relative path is specified, UriKind is set to Relative
The line itself in the code looks like:
webbrowser->URL = (gcnew System::URIs(L" /HTML_page.htm", System::UriKind::Relative));
The error that occurs when setting a link like this:
It is not possible to navigate to the corresponding URL.
This error does not occur when specifying an absolute path to a file located on the local machine.
How can I open a local web page with a relative link?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
d-stream, 2018-03-31
@d-stream

webbrowser->URL = (gcnew System::URIs(L" . /HTML_page.htm", System::UriKind::Relative)); not?

M
microfrog, 2018-03-31
@microfrog

Maybe
webbrowser->URL = (gcnew System::URIs(L"file://HTML_page.htm", System::UriKind::Relative));
It is better, for starters, to try to register the full absolute path.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question