Retrieves the title of the currently loaded HTML document.
Takes htmlViewID (Int).
Returns UTF-8 title string, or empty string "" if htmlViewID not found or title unavailable.
BGI GUI
Parameters & Returns
Parameters
htmlViewIDInt
Returns
String
Quick Summary
Retrieves the title of the currently loaded HTML document.
Takes htmlViewID (Int).
Returns UTF-8 title string, or empty string "" if htmlViewID not found or title unavailable.
Technical Exegesis...
Retrieves the title of the currently loaded HTML document. Searches webBrowserMap for htmlViewID. If found, gets IWebBrowser2* interface. Calls get_LocationName(&bstrTitle) to retrieve document title BSTR. Converts BSTR to UTF-8 std::string using WideCharToMultiByte with CP_UTF8. SysFreeString releases BSTR. Returns UTF-8 title string, or empty string "" if htmlViewID not found or title unavailable.
This function returns the document's <title> element content.
Retrieves the title of the currently loaded HTML document. Searches webBrowserMap for htmlViewID. If found, gets IWebBrowser2* interface. Calls get_LocationName(&bstrTitle) to retrieve document title BSTR. Converts BSTR to UTF-8 std::string using WideCharToMultiByte with CP_UTF8. SysFreeString releases BSTR. Returns UTF-8 title string, or empty string "" if htmlViewID not found or title unavailable.
This function returns the document's <title> element content. get_LocationName() retrieves the page title (not URL - despite "Location" in name). For HTML documents, returns text inside <title></title> tags. For pages without <title>, may return URL or empty string. BSTR to UTF-8 conversion handles international characters in titles. Returns empty string if document not loaded yet or navigation in progress. Use cases: display page title in window title bar, tab labels, or navigation breadcrumbs. Title updates automatically when navigating to new pages. For content loaded via bgiSetHTMLContent, title is whatever appears in HTML <title> tag. Common pattern: call after navigation to update UI with page title.