OWL NExt - Knowledge Base

[ Home | Contents | Search | Next | Previous | Up ]

TDialog left side title bar icon?

Date: 11/30/99
Time: 12:19:27 AM

Q. How do you specify a bitmap for the system menu button on the left end of a TDialog titlebar?

A.
Here code add this code in SetupWindow()

void SetupSmallIcon(uint resId)
{
    // Only proceed if the system supports small icons
    if (!TSystem::HasSmallIcon())
        return;
    HICON CurIconSm;
    HINSTANCE hInstance = *GetModule();
    if (resId != 0) {
        CurIconSm = (HICON)::LoadImage(hInstance, resId, IMAGE_ICON, TUIMetric::CxSmIcon, TUIMetric::CySmIcon, LR_DEFAULTCOLOR);
        if (!CurIconSm)
            CurIconSm = TUser::LoadIcon(hInstance, resId);
    }
    if (CurIconSm && IsWindow())
        SendMessage(WM_SETICON, false, (LPARAM)(HICON)CurIconSm);
    else{
        MessageBox(0,"You must call SetupSmallIcon() after TDialog::SetupWindow()","Developer Error", MB_OK);
}

Yura :-)

Last changed: July 14, 2001