HTML:Show icon in the title bar of app dialog

Version: 2018

Type: Features

Category: Programming

Subcategory: Origin C

Jira: ORG-16873

Two new member functions are added to OC Window class:

HICON Window::SetIcon(HICON hIcon, BOOL bBigIcon = FALSE);
HICON Window::GetIcon(BOOL bBigIcon = FALSE);

A new util function is also added to make it easier to set the icon from given icon file:

HICON set_window_icon_from_file(HWND hWnd, LPCSTR szIconPath)

See below for the example of setting the icon of the HTML app dialog:

BOOL CMyHTMLDlg::OnInitDialog()
    HTMLDlg::OnInitDialog(); // Call base class.
    string strIconPath = __FILE__;
    strIconPath = GetFilePath(strIconPath) + "test.ico";
    set_window_icon_from_file(GetSafeHwnd(), strIconPath);
    return TRUE