Retrieves the current URL of the loaded document in the HTMLView control.
Takes htmlViewID (Int).
Returns UTF-8 URL string, or empty string "" if htmlViewID not found or URL unavailable.
BGI GUI
Parameters & Returns
Parameters
htmlViewIDInt
Returns
String
Quick Summary
Retrieves the current URL of the loaded document in the HTMLView control.
Takes htmlViewID (Int).
Returns UTF-8 URL string, or empty string "" if htmlViewID not found or URL unavailable.
Technical Exegesis...
Retrieves the current URL of the loaded document in the HTMLView control. Searches webBrowserMap for htmlViewID. If found, gets IWebBrowser2* interface. Calls get_LocationURL(&bstrURL) to retrieve current location BSTR. Converts BSTR to UTF-8 std::string using WideCharToMultiByte with CP_UTF8. SysFreeString releases BSTR. Returns UTF-8 URL string, or empty string "" if htmlViewID not found or URL unavailable.
This function returns the document's current URL/location.
Retrieves the current URL of the loaded document in the HTMLView control. Searches webBrowserMap for htmlViewID. If found, gets IWebBrowser2* interface. Calls get_LocationURL(&bstrURL) to retrieve current location BSTR. Converts BSTR to UTF-8 std::string using WideCharToMultiByte with CP_UTF8. SysFreeString releases BSTR. Returns UTF-8 URL string, or empty string "" if htmlViewID not found or URL unavailable.
This function returns the document's current URL/location. get_LocationURL() retrieves complete URL including protocol (http://, https://, file:///, about:). For web pages, returns full URL as shown in address bar. For local files, returns file:/// path. For content loaded via bgiSetHTMLContent, returns "about:blank". BSTR to UTF-8 conversion handles international characters in URLs (percent-encoded). URL updates automatically during navigation (including links clicked within page). Returns empty string if document not loaded yet. Use cases: verify successful navigation, display current location in address bar, track navigation history. URL changes after bgiLoadHTMLURL completes, after user clicks links, or after bgiHTMLGoBack/Forward. Common pattern: poll bgiGetHTMLURL after navigation to confirm page load, update UI with current location.