Archicad C++ API
About Archicad add-on development using the C++ API.

Open Webbrowser?

Joel Buehler

Hehey evryone


i hope my question is not to obvious, but im having trouble to start the webbrowser with a given url from a add-on. 

how do i do that?


i know so far:

we can save url documentation data in a element with the calls


and the notification example show how to add and retrieve this url data

but it does not show how to open that given url...


we can edit the Add-Ons help URL with the DGRegisterAdditionalHelpLocation, but it also does not show how to open that url... or am i missing something? 

Viktor Kovacs

Not sure if I understand the question correctly, but you can open any url with the default web browser by using the OSUtils::OpenWithDefaultBrowser call from the DefaultProgramRunner.hpp header.

works like a charm! thank you very much! 


i recommend to add this to one of the examples. 


I did something similar few months ago. In general, you can execute any app from within your plugin using ShellExecute() in Windows and std::system() for Mac, something like this

#if defined (WINDOWS)
		LPCWSTR command = L"";
		ShellExecute(NULL, L"open", command, NULL, NULL, SW_SHOWNORMAL);
#elif defined (macintosh)
		GS::UniString command = "open";


Miklos Vegh

And you can also show a webpage inside your dialog by adding a DG::Browser dialog item and loading the URL by calling the LoadURL (const GS::UniString& url) member function.

thanks 😄 

im a big fan of the DG::Browser Dialog and i made the whole gui as a browser dialog since i like html a lot better then the DG Framework 😄



i thought to open a new dialog to show help documents would be unusual behavior since archicad also opens a webbroser for help resources.  



Hi Joel, in your pluggin do you open a local HTML file or an outside webpage on the browser?

im hosting the html on a subdomain.

with the html.LoadHTML(htmlstring) method you can load local html, waht is very cool. but i was never able to have a html file and feed this to the ressources compiler tool. =(


i developed the following hacks:


1. you can have your html in the "AddOnFix.grc". like this:



this html can you then call with somethink like this:



2. you can have your html directly in your code and consume it with the LoadHTML function. something like this:







You can add a html file as a resource by adding it as a DATA resource. For example:

'DATA' 2024 "HTML Resource" {

The resource can be loaded like this (I did not compile it):

GS::UniString htmlStr;
GSHandle resHandle = RSLoadResource ('DATA', resModule, 2024);
if (resHandle != nullptr) {
	USize hdlSize = BMGetHandleSize (resHandle);
	const char* p = (const char*) *resHandle;
	htmlStr = GS::UniString (p, hdlSize);
	BMKillHandle (&resHandle);

The loaded resource data does not contain a terminating zero, so a length is needed to the UniString constructor.

The string can then be loaded to a browser control.

Viktor Kovacs

Also, you can check the Browser_Control example Add-On in the Development Kit. It's a full example of using a browser control, and storing a html file as a resource.

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!