您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetWindowTheme函数代码示例

51自学网 2021-06-01 21:18:09
  C++
这篇教程C++ GetWindowTheme函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GetWindowTheme函数的典型用法代码示例。如果您正苦于以下问题:C++ GetWindowTheme函数的具体用法?C++ GetWindowTheme怎么用?C++ GetWindowTheme使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GetWindowTheme函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: THEMING_EditSubclassProc

/********************************************************************** * The edit control subclass window proc. */LRESULT CALLBACK THEMING_EditSubclassProc (HWND hwnd, UINT msg,                                            WPARAM wParam, LPARAM lParam,                                            ULONG_PTR dwRefData){    const WCHAR* themeClass = WC_EDITW;    HTHEME theme;    LRESULT result;          switch (msg)    {    case WM_CREATE:        result = THEMING_CallOriginalClass  (hwnd, msg, wParam, lParam);        OpenThemeData( hwnd, themeClass );        return result;        case WM_DESTROY:        theme = GetWindowTheme( hwnd );        CloseThemeData ( theme );        return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);    case WM_THEMECHANGED:        theme = GetWindowTheme( hwnd );        CloseThemeData ( theme );        OpenThemeData( hwnd, themeClass );        break;            case WM_SYSCOLORCHANGE:        theme = GetWindowTheme( hwnd );	if (!theme) return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);        /* Do nothing. When themed, a WM_THEMECHANGED will be received, too,   	 * which will do the repaint. */        break;            case WM_NCPAINT:        theme = GetWindowTheme( hwnd );        if (!theme) return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);        nc_paint (theme, hwnd, (HRGN)wParam);        break;    case WM_ENABLE:    case WM_KILLFOCUS:    case WM_SETFOCUS:        theme = GetWindowTheme( hwnd );        if (theme) RedrawWindow (hwnd, NULL, NULL,             RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);        return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);            default: 	/* Call old proc */	return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);    }    return 0;}
开发者ID:GYGit,项目名称:reactos,代码行数:56,


示例2: UPDOWN_Draw

/*********************************************************************** * UPDOWN_Draw * * Draw the arrows. The background need not be erased. */static LRESULT UPDOWN_Draw (const UPDOWN_INFO *infoPtr, HDC hdc){    BOOL uPressed, uHot, dPressed, dHot;    RECT rect;    HTHEME theme = GetWindowTheme (infoPtr->Self);    int uPart = 0, uState = 0, dPart = 0, dState = 0;    BOOL needBuddyBg = FALSE;    uPressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_INCR);    uHot = (infoPtr->Flags & FLAG_INCR) && (infoPtr->Flags & FLAG_MOUSEIN);    dPressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_DECR);    dHot = (infoPtr->Flags & FLAG_DECR) && (infoPtr->Flags & FLAG_MOUSEIN);    if (theme) {        uPart = (infoPtr->dwStyle & UDS_HORZ) ? SPNP_UPHORZ : SPNP_UP;        uState = (infoPtr->dwStyle & WS_DISABLED) ? DNS_DISABLED             : (uPressed ? DNS_PRESSED : (uHot ? DNS_HOT : DNS_NORMAL));        dPart = (infoPtr->dwStyle & UDS_HORZ) ? SPNP_DOWNHORZ : SPNP_DOWN;        dState = (infoPtr->dwStyle & WS_DISABLED) ? DNS_DISABLED             : (dPressed ? DNS_PRESSED : (dHot ? DNS_HOT : DNS_NORMAL));        needBuddyBg = IsWindow (infoPtr->Buddy)            && (IsThemeBackgroundPartiallyTransparent (theme, uPart, uState)              || IsThemeBackgroundPartiallyTransparent (theme, dPart, dState));    }    /* Draw the common border between ourselves and our buddy */    if (UPDOWN_HasBuddyBorder(infoPtr) || needBuddyBg) {        if (!theme || !UPDOWN_DrawBuddyBackground (infoPtr, hdc)) {            GetClientRect(infoPtr->Self, &rect);	    DrawEdge(hdc, &rect, EDGE_SUNKEN,		     BF_BOTTOM | BF_TOP |		     (infoPtr->dwStyle & UDS_ALIGNLEFT ? BF_LEFT : BF_RIGHT));        }    }    /* Draw the incr button */    UPDOWN_GetArrowRect (infoPtr, &rect, FLAG_INCR);    if (theme) {        DrawThemeBackground(theme, hdc, uPart, uState, &rect, NULL);    } else {        DrawFrameControl(hdc, &rect, DFC_SCROLL,            (infoPtr->dwStyle & UDS_HORZ ? DFCS_SCROLLRIGHT : DFCS_SCROLLUP) |            ((infoPtr->dwStyle & UDS_HOTTRACK) && uHot ? DFCS_HOT : 0) |            (uPressed ? DFCS_PUSHED : 0) |            (infoPtr->dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) );    }    /* Draw the decr button */    UPDOWN_GetArrowRect(infoPtr, &rect, FLAG_DECR);    if (theme) {        DrawThemeBackground(theme, hdc, dPart, dState, &rect, NULL);    } else {        DrawFrameControl(hdc, &rect, DFC_SCROLL,            (infoPtr->dwStyle & UDS_HORZ ? DFCS_SCROLLLEFT : DFCS_SCROLLDOWN) |            ((infoPtr->dwStyle & UDS_HOTTRACK) && dHot ? DFCS_HOT : 0) |            (dPressed ? DFCS_PUSHED : 0) |            (infoPtr->dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) );    }    return 0;}
开发者ID:devyn,项目名称:wine,代码行数:65,


示例3: theme_changed

/* update theme after a WM_THEMECHANGED message */static LRESULT theme_changed (const STATUS_INFO* infoPtr){    HTHEME theme = GetWindowTheme (infoPtr->Self);    CloseThemeData (theme);    OpenThemeData (infoPtr->Self, themeClass);    return 0;}
开发者ID:ccpgames,项目名称:wine,代码行数:8,


示例4: STATUSBAR_RefreshPart

static voidSTATUSBAR_RefreshPart (const STATUS_INFO *infoPtr, HDC hdc, const STATUSWINDOWPART *part, int itemID){    HBRUSH hbrBk;    HTHEME theme;    TRACE("item %d/n", itemID);    if (part->bound.right < part->bound.left) return;    if (!RectVisible(hdc, &part->bound))        return;    if ((theme = GetWindowTheme (infoPtr->Self)))    {        RECT cr;        GetClientRect (infoPtr->Self, &cr);        DrawThemeBackground(theme, hdc, 0, 0, &cr, &part->bound);    }    else    {        if (infoPtr->clrBk != CLR_DEFAULT)                hbrBk = CreateSolidBrush (infoPtr->clrBk);        else                hbrBk = GetSysColorBrush (COLOR_3DFACE);        FillRect(hdc, &part->bound, hbrBk);        if (infoPtr->clrBk != CLR_DEFAULT)                DeleteObject (hbrBk);    }    STATUSBAR_DrawPart (infoPtr, hdc, part, itemID);}
开发者ID:ccpgames,项目名称:wine,代码行数:32,


示例5: STATUSBAR_WMDestroy

static LRESULTSTATUSBAR_WMDestroy (STATUS_INFO *infoPtr){    unsigned int i;    TRACE("/n");    for (i = 0; i < infoPtr->numParts; i++) {	if (!(infoPtr->parts[i].style & SBT_OWNERDRAW))	    Free (infoPtr->parts[i].text);    }    if (!(infoPtr->part0.style & SBT_OWNERDRAW))	Free (infoPtr->part0.text);    Free (infoPtr->parts);    /* delete default font */    if (infoPtr->hDefaultFont)	DeleteObject (infoPtr->hDefaultFont);    /* delete tool tip control */    if (infoPtr->hwndToolTip)	DestroyWindow (infoPtr->hwndToolTip);    CloseThemeData (GetWindowTheme (infoPtr->Self));    SetWindowLongPtrW(infoPtr->Self, 0, 0);    Free (infoPtr);    return 0;}
开发者ID:ccpgames,项目名称:wine,代码行数:28,


示例6: STATUSBAR_ComputeHeight

static UINTSTATUSBAR_ComputeHeight(STATUS_INFO *infoPtr){    HTHEME theme;    UINT height;    TEXTMETRICW tm;    int margin;    COMCTL32_GetFontMetrics(infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont, &tm);    margin = (tm.tmInternalLeading ? tm.tmInternalLeading : 2);    height = max(tm.tmHeight + margin + 2*GetSystemMetrics(SM_CYBORDER), infoPtr->minHeight) + infoPtr->verticalBorder;    if ((theme = GetWindowTheme(infoPtr->Self)))    {        /* Determine bar height from theme such that the content area is         * textHeight pixels large */        HDC hdc = GetDC(infoPtr->Self);        RECT r;        SetRect(&r, 0, 0, 0, max(infoPtr->minHeight, tm.tmHeight));        if (SUCCEEDED(GetThemeBackgroundExtent(theme, hdc, SP_PANE, 0, &r, &r)))        {            height = r.bottom - r.top;        }        ReleaseDC(infoPtr->Self, hdc);    }    TRACE("    textHeight=%d+%d, final height=%d/n", tm.tmHeight, tm.tmInternalLeading, height);    return height;}
开发者ID:ccpgames,项目名称:wine,代码行数:30,


示例7: UPDOWN_DrawBuddyBackground

/*********************************************************************** * UPDOWN_DrawBuddyBackground * * Draw buddy background for visual integration. */static BOOL UPDOWN_DrawBuddyBackground (const UPDOWN_INFO *infoPtr, HDC hdc){    RECT br;    HTHEME buddyTheme = GetWindowTheme (infoPtr->Buddy);    if (!buddyTheme) return FALSE;    GetClientRect (infoPtr->Buddy, &br);    MapWindowPoints (infoPtr->Buddy, infoPtr->Self, (POINT*)&br, 2);    /* FIXME: take disabled etc. into account */    DrawThemeBackground (buddyTheme, hdc, 0, 0, &br, NULL);    return TRUE;}
开发者ID:devyn,项目名称:wine,代码行数:17,


示例8: get_led_gap

/* Helper to obtain gap between progress bar chunks */static inline int get_led_gap ( PROGRESS_INFO *infoPtr ){    HTHEME theme = GetWindowTheme (infoPtr->Self);    if (theme)    {        int spaceSize;        if (SUCCEEDED( GetThemeInt( theme, 0, 0, TMT_PROGRESSSPACESIZE, &spaceSize )))            return spaceSize;    }    return LED_GAP;}
开发者ID:howard5888,项目名称:wineT,代码行数:13,


示例9: STATUSBAR_DrawPart

static voidSTATUSBAR_DrawPart (const STATUS_INFO *infoPtr, HDC hdc, const STATUSWINDOWPART *part, int itemID){    RECT r = part->bound;    UINT border = BDR_SUNKENOUTER;    HTHEME theme = GetWindowTheme (infoPtr->Self);    int themePart = SP_PANE;    int x = 0;    TRACE("part bound %s/n", wine_dbgstr_rect(&r));    if (part->style & SBT_POPOUT)        border = BDR_RAISEDOUTER;    else if (part->style & SBT_NOBORDERS)        border = 0;    if (theme)    {        if ((GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP)            && (infoPtr->simple || (itemID == (infoPtr->numParts-1))))            themePart = SP_GRIPPERPANE;        DrawThemeBackground(theme, hdc, themePart, 0, &r, NULL);    }    else        DrawEdge(hdc, &r, border, BF_RECT|BF_ADJUST);    if (part->hIcon) {        INT cy = r.bottom - r.top;        DrawIconEx (hdc, r.left + 2, r.top, part->hIcon, cy, cy, 0, 0, DI_NORMAL);        x = 2 + cy;    }    if (part->style & SBT_OWNERDRAW) {	DRAWITEMSTRUCT dis;	dis.CtlID = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);	dis.itemID = itemID;	dis.hwndItem = infoPtr->Self;	dis.hDC = hdc;	dis.rcItem = r;	dis.itemData = (ULONG_PTR)part->text;        SendMessageW (infoPtr->Notify, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis);    } else {        r.left += x;#ifdef __REACTOS__        if (!theme)            DrawStatusTextW (hdc, &r, part->text, SBT_NOBORDERS);        else            DrawThemeText(theme, hdc, SP_PANE, 0, part->text, -1, DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX, 0, &r);#else        DrawStatusTextW (hdc, &r, part->text, SBT_NOBORDERS);#endif    }}
开发者ID:amaneureka,项目名称:reactos,代码行数:53,


示例10: get_client_rect

/* Get client rect. Takes into account that theming needs no adjustment. */static inline void get_client_rect (HWND hwnd, RECT* rect){    HTHEME theme = GetWindowTheme (hwnd);    GetClientRect (hwnd, rect);    if (!theme)        InflateRect(rect, -1, -1);    else    {        DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);        int part = (dwStyle & PBS_VERTICAL) ? PP_BARVERT : PP_BAR;        GetThemeBackgroundContentRect (theme, 0, part, 0, rect, rect);    }}
开发者ID:howard5888,项目名称:wineT,代码行数:14,


示例11: STATUSBAR_Refresh

static LRESULTSTATUSBAR_Refresh (STATUS_INFO *infoPtr, HDC hdc){    RECT   rect;    HBRUSH hbrBk;    HFONT  hOldFont;    HTHEME theme;    TRACE("/n");    if (!IsWindowVisible(infoPtr->Self))        return 0;    STATUSBAR_SetPartBounds(infoPtr);    GetClientRect (infoPtr->Self, &rect);    if ((theme = GetWindowTheme (infoPtr->Self)))    {        DrawThemeBackground(theme, hdc, 0, 0, &rect, NULL);    }    else    {        if (infoPtr->clrBk != CLR_DEFAULT)            hbrBk = CreateSolidBrush (infoPtr->clrBk);        else            hbrBk = GetSysColorBrush (COLOR_3DFACE);        FillRect(hdc, &rect, hbrBk);        if (infoPtr->clrBk != CLR_DEFAULT)            DeleteObject (hbrBk);    }    hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);    if (infoPtr->simple) {	STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->part0, 0);    } else {        unsigned int i;	for (i = 0; i < infoPtr->numParts; i++) {	    STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->parts[i], i);	}    }    SelectObject (hdc, hOldFont);    if ((GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP)            && !(GetWindowLongW (infoPtr->Notify, GWL_STYLE) & WS_MAXIMIZE))	    STATUSBAR_DrawSizeGrip (theme, hdc, &rect);    return 0;}
开发者ID:Jactry,项目名称:wine,代码行数:51,


示例12: ShowWindow

HRESULT CMenuToolbarBase::ShowDW(BOOL fShow){    ShowWindow(fShow ? SW_SHOW : SW_HIDE);    // Ensure that the right image list is assigned to the toolbar    UpdateImageLists();    // For custom-drawing    if (IsAppThemed())        GetThemeSysBool(GetWindowTheme(m_hWnd), TMT_FLATMENUS);    else        SystemParametersInfo(SPI_GETFLATMENU, 0, &m_useFlatMenus, 0);    return S_OK;}
开发者ID:mvardan,项目名称:ros-svn-mirror,代码行数:15,


示例13: get_led_size

/* Helper to obtain size of a progress bar chunk ("led"). */static inline int get_led_size ( PROGRESS_INFO *infoPtr, LONG style,                                 const RECT* rect ){    HTHEME theme = GetWindowTheme (infoPtr->Self);    if (theme)    {        int chunkSize;        if (SUCCEEDED( GetThemeInt( theme, 0, 0, TMT_PROGRESSCHUNKSIZE, &chunkSize )))            return chunkSize;    }    if (style & PBS_VERTICAL)        return MulDiv (rect->right - rect->left, 2, 3);    else        return MulDiv (rect->bottom - rect->top, 2, 3);}
开发者ID:howard5888,项目名称:wineT,代码行数:17,


示例14: UPDOWN_GetArrowRect

/*********************************************************************** *           UPDOWN_GetArrowRect * wndPtr   - pointer to the up-down wnd * rect     - will hold the rectangle * arrow    - FLAG_INCR to get the "increment" rect (up or right) *            FLAG_DECR to get the "decrement" rect (down or left) *            If both flags are present, the envelope is returned. */static void UPDOWN_GetArrowRect (const UPDOWN_INFO* infoPtr, RECT *rect, int arrow){    HTHEME theme = GetWindowTheme (infoPtr->Self);    const int border = theme ? DEFAULT_BUDDYBORDER_THEMED : DEFAULT_BUDDYBORDER;    const int spacer = theme ? DEFAULT_BUDDYSPACER_THEMED : DEFAULT_BUDDYSPACER;    GetClientRect (infoPtr->Self, rect);    /*     * Make sure we calculate the rectangle to fit even if we draw the     * border.     */    if (UPDOWN_HasBuddyBorder(infoPtr)) {        if (infoPtr->dwStyle & UDS_ALIGNLEFT)            rect->left += border;        else            rect->right -= border;        InflateRect(rect, 0, -border);    }    /* now figure out if we need a space away from the buddy */    if (IsWindow(infoPtr->Buddy) ) {	if (infoPtr->dwStyle & UDS_ALIGNLEFT) rect->right -= spacer;	else rect->left += spacer;    }    /*     * We're calculating the midpoint to figure-out where the     * separation between the buttons will lay. We make sure that we     * round the uneven numbers by adding 1.     */    if (infoPtr->dwStyle & UDS_HORZ) {        int len = rect->right - rect->left + 1; /* compute the width */        if (arrow & FLAG_INCR)            rect->left = rect->left + len/2;        if (arrow & FLAG_DECR)            rect->right =  rect->left + len/2 - (theme ? 0 : 1);    } else {        int len = rect->bottom - rect->top + 1; /* compute the height */        if (arrow & FLAG_INCR)            rect->bottom =  rect->top + len/2 - (theme ? 0 : 1);        if (arrow & FLAG_DECR)            rect->top =  rect->top + len/2;    }}
开发者ID:devyn,项目名称:wine,代码行数:53,


示例15: UPDOWN_DrawBuddyBackground

/*********************************************************************** * UPDOWN_DrawBuddyBackground * * Draw buddy background for visual integration. */static BOOL UPDOWN_DrawBuddyBackground (const UPDOWN_INFO *infoPtr, HDC hdc){    RECT br, r;    HTHEME buddyTheme = GetWindowTheme (infoPtr->Buddy);    if (!buddyTheme) return FALSE;    GetWindowRect (infoPtr->Buddy, &br);    MapWindowPoints (NULL, infoPtr->Self, (POINT*)&br, 2);    GetClientRect (infoPtr->Self, &r);    if (infoPtr->dwStyle & UDS_ALIGNLEFT)        br.left = r.left;    else if (infoPtr->dwStyle & UDS_ALIGNRIGHT)        br.right = r.right;    /* FIXME: take disabled etc. into account */    DrawThemeBackground (buddyTheme, hdc, 0, 0, &br, NULL);    return TRUE;}
开发者ID:AlexSteel,项目名称:wine,代码行数:23,


示例16: THEMING_DialogSubclassProc

/********************************************************************** * The dialog subclass window proc. */LRESULT CALLBACK THEMING_DialogSubclassProc (HWND hWnd, UINT msg,                                              WPARAM wParam, LPARAM lParam,                                              ULONG_PTR dwRefData){    HTHEME theme = GetWindowTheme ( hWnd );    static const WCHAR themeClass[] = { 'W','i','n','d','o','w',0 };    BOOL themingActive = IsThemeDialogTextureEnabled (hWnd);    BOOL doTheming = themingActive && (theme != NULL);    LRESULT result;          switch (msg)    {    case WM_CREATE:	result = THEMING_CallOriginalClass (hWnd, msg, wParam, lParam);	theme = OpenThemeData( hWnd, themeClass );	return result;        case WM_DESTROY:        CloseThemeData ( theme );        SetWindowTheme( hWnd, NULL, NULL );        OpenThemeData( hWnd, NULL );        return THEMING_CallOriginalClass (hWnd, msg, wParam, lParam);    case WM_THEMECHANGED:        CloseThemeData ( theme );	OpenThemeData( hWnd, themeClass );	InvalidateRect( hWnd, NULL, TRUE );	return 0;	    case WM_SYSCOLORCHANGE:	if (!doTheming) return THEMING_CallOriginalClass (hWnd, msg, wParam, lParam);        /* Do nothing. When themed, a WM_THEMECHANGED will be received, too,   	 * which will do the repaint. */        break;            case WM_ERASEBKGND:	if (!doTheming) return THEMING_CallOriginalClass (hWnd, msg, wParam, lParam);        {            RECT rc;            WNDPROC dlgp = (WNDPROC)GetWindowLongPtrW (hWnd, DWLP_DLGPROC);            if (!CallWindowProcW(dlgp, hWnd, msg, wParam, lParam))            {                /* Draw background*/                GetClientRect (hWnd, &rc);                if (IsThemePartDefined (theme, WP_DIALOG, 0))                    /* Although there is a theme for the WINDOW class/DIALOG part,                      * but I[res] haven't seen Windows using it yet... Even when                     * dialog theming is activated, the good ol' BTNFACE                      * background seems to be used. */#if 0                    DrawThemeBackground (theme, (HDC)wParam, WP_DIALOG, 0, &rc,                         NULL);#endif                    return THEMING_CallOriginalClass (hWnd, msg, wParam, lParam);                else                 /* We might have gotten a TAB theme class, so check if we can                  * draw as a tab page. */                if (IsThemePartDefined (theme, TABP_BODY, 0))                    DrawThemeBackground (theme, (HDC)wParam, TABP_BODY, 0, &rc,                         NULL);                else                    return THEMING_CallOriginalClass (hWnd, msg, wParam, lParam);            }            return 1;        }
开发者ID:hoangduit,项目名称:reactos,代码行数:68,


示例17: THEMING_ComboSubclassProc

/********************************************************************** * The combo control subclass window proc. */LRESULT CALLBACK THEMING_ComboSubclassProc (HWND hwnd, UINT msg,                                             WPARAM wParam, LPARAM lParam,                                             ULONG_PTR dwRefData){    const WCHAR* themeClass = WC_COMBOBOXW;    HTHEME theme;    LRESULT result;          switch (msg)    {    case WM_CREATE:        result = THEMING_CallOriginalClass  (hwnd, msg, wParam, lParam);        OpenThemeData( hwnd, themeClass );        return result;        case WM_DESTROY:        theme = GetWindowTheme( hwnd );        CloseThemeData ( theme );        return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);    case WM_THEMECHANGED:        theme = GetWindowTheme( hwnd );        CloseThemeData ( theme );        OpenThemeData( hwnd, themeClass );        break;            case WM_SYSCOLORCHANGE:        theme = GetWindowTheme( hwnd );	if (!theme) return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);        /* Do nothing. When themed, a WM_THEMECHANGED will be received, too,   	 * which will do the repaint. */        break;            case WM_PAINT:        theme = GetWindowTheme( hwnd );        if (!theme) return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);        return paint (theme, hwnd, (HDC)wParam, dwRefData);    case WM_SETREDRAW:        /* Since there doesn't seem to be WM_GETREDRAW, do redraw tracking in          * the subclass as well. */        if( wParam )            dwRefData &= ~STATE_NOREDRAW;        else            dwRefData |= STATE_NOREDRAW;        THEMING_SetSubclassData (hwnd, dwRefData);        return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);            case WM_MOUSEMOVE:        {            /* Dropdown button hot-tracking */            COMBOBOXINFO cbi;            POINT pt;            pt.x = (short)LOWORD(lParam);            pt.y = (short)HIWORD(lParam);            cbi.cbSize = sizeof (cbi);            SendMessageW (hwnd, CB_GETCOMBOBOXINFO, 0, (LPARAM)&cbi);                        if (cbi.stateButton != STATE_SYSTEM_INVISIBLE)            {                if (PtInRect (&cbi.rcButton, pt))                {                    if (!(dwRefData & STATE_HOT))                    {                        dwRefData |= STATE_HOT;                        THEMING_SetSubclassData (hwnd, dwRefData);                        RedrawWindow (hwnd, &cbi.rcButton, 0,                             RDW_INVALIDATE | RDW_UPDATENOW);                    }                }                else                {                    if (dwRefData & STATE_HOT)                    {                        dwRefData &= ~STATE_HOT;                        THEMING_SetSubclassData (hwnd, dwRefData);                        RedrawWindow (hwnd, &cbi.rcButton, 0,                             RDW_INVALIDATE | RDW_UPDATENOW);                    }                }            }        }        return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);        default: 	/* Call old proc */	return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);    }    return 0;}
开发者ID:hoangduit,项目名称:reactos,代码行数:94,


示例18: SubclassWindow

HRESULT CMenuToolbarBase::CreateToolbar(HWND hwndParent, DWORD dwFlags){    LONG tbStyles = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |        TBSTYLE_TOOLTIPS | TBSTYLE_TRANSPARENT | TBSTYLE_REGISTERDROP | TBSTYLE_LIST | TBSTYLE_FLAT | TBSTYLE_CUSTOMERASE |        CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_NORESIZE | CCS_TOP;    LONG tbExStyles = TBSTYLE_EX_DOUBLEBUFFER | WS_EX_TOOLWINDOW;    if (dwFlags & SMINIT_VERTICAL)    {        // Activate vertical semantics        tbStyles |= CCS_VERT;#if USE_TBSTYLE_EX_VERTICAL        tbExStyles |= TBSTYLE_EX_VERTICAL;#endif    }    m_initFlags = dwFlags;    // Get a temporary rect to use while creating the toolbar window.    // Ensure that it is not a null rect.    RECT rc;    if (!::GetClientRect(hwndParent, &rc) ||        (rc.left == rc.right) ||        (rc.top == rc.bottom))    {        rc.left = 0;        rc.top = 0;        rc.right = 1;        rc.bottom = 1;    }    SubclassWindow(CToolbar::Create(hwndParent, tbStyles, tbExStyles));    SetWindowTheme(m_hWnd, L"", L"");    if (IsAppThemed())        GetThemeSysBool(GetWindowTheme(m_hWnd), TMT_FLATMENUS);    else        SystemParametersInfo(SPI_GETFLATMENU, 0, &m_useFlatMenus, 0);    m_menuBand->AdjustForTheme(m_useFlatMenus);    // If needed, create the pager.    if (m_usePager)    {        LONG pgStyles = PGS_VERT | WS_CHILD | WS_VISIBLE;        LONG pgExStyles = 0;        HWND hwndPager = CreateWindowEx(            pgExStyles, WC_PAGESCROLLER, NULL,            pgStyles, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,            hwndParent, NULL, _AtlBaseModule.GetModuleInstance(), 0);        m_pager.SubclassWindow(hwndPager);        ::SetParent(m_hWnd, hwndPager);                m_pager.SendMessageW(PGM_SETCHILD, 0, reinterpret_cast<LPARAM>(m_hWnd));    }    // Configure the image lists    UpdateImageLists();    return S_OK;}
开发者ID:mvardan,项目名称:ros-svn-mirror,代码行数:66,


示例19: UpDownWindowProc

/*********************************************************************** *           UpDownWndProc */static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){    UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd);    static const WCHAR themeClass[] = {'S','p','i','n',0};    HTHEME theme;    TRACE("hwnd=%p msg=%04x wparam=%08lx lparam=%08lx/n", hwnd, message, wParam, lParam);    if (!infoPtr && (message != WM_CREATE))        return DefWindowProcW (hwnd, message, wParam, lParam);    switch(message)    {        case WM_CREATE:            infoPtr = Alloc (sizeof(UPDOWN_INFO));	    SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);	    /* initialize the info struct */	    infoPtr->Self = hwnd;	    infoPtr->Notify = ((LPCREATESTRUCTW)lParam)->hwndParent;            infoPtr->dwStyle = ((LPCREATESTRUCTW)lParam)->style;	    infoPtr->AccelCount = 0;	    infoPtr->AccelVect = 0;	    infoPtr->AccelIndex = -1;	    infoPtr->CurVal = 0;	    infoPtr->MinVal = 100;	    infoPtr->MaxVal = 0;	    infoPtr->Base  = 10; /* Default to base 10  */	    infoPtr->Buddy = 0;  /* No buddy window yet */	    infoPtr->Flags = 0;  /* And no flags        */            SetWindowLongW (hwnd, GWL_STYLE, infoPtr->dwStyle & ~WS_BORDER);            /* Do we pick the buddy win ourselves? */	    if (infoPtr->dwStyle & UDS_AUTOBUDDY)		UPDOWN_SetBuddy (infoPtr, GetWindow (hwnd, GW_HWNDPREV));            OpenThemeData (hwnd, themeClass);	    TRACE("UpDown Ctrl creation, hwnd=%p/n", hwnd);	    break;	case WM_DESTROY:	    Free (infoPtr->AccelVect);	    if(infoPtr->Buddy) RemovePropW(infoPtr->Buddy, BUDDY_UPDOWN_HWND);	    Free (infoPtr);	    SetWindowLongPtrW (hwnd, 0, 0);            theme = GetWindowTheme (hwnd);            CloseThemeData (theme);	    TRACE("UpDown Ctrl destruction, hwnd=%p/n", hwnd);	    break;	case WM_ENABLE:	    if (wParam) {		infoPtr->dwStyle &= ~WS_DISABLED;	    } else {		infoPtr->dwStyle |= WS_DISABLED;	    	UPDOWN_CancelMode (infoPtr);	    }	    InvalidateRect (infoPtr->Self, NULL, FALSE);	    break;        case WM_STYLECHANGED:            if (wParam == GWL_STYLE) {                infoPtr->dwStyle = ((LPSTYLESTRUCT)lParam)->styleNew;	        InvalidateRect (infoPtr->Self, NULL, FALSE);            }            break;        case WM_THEMECHANGED:            theme = GetWindowTheme (hwnd);            CloseThemeData (theme);            OpenThemeData (hwnd, themeClass);            InvalidateRect (hwnd, NULL, FALSE);            break;	case WM_TIMER:	   /* is this the auto-press timer? */	   if(wParam == TIMER_AUTOPRESS) {		KillTimer(hwnd, TIMER_AUTOPRESS);		infoPtr->Flags &= ~(FLAG_PRESSED | FLAG_ARROW);		InvalidateRect(infoPtr->Self, NULL, FALSE);	   }	   /* if initial timer, kill it and start the repeat timer */  	   if(wParam == TIMER_AUTOREPEAT) {		int temp;		KillTimer(hwnd, TIMER_AUTOREPEAT);		/* if no accel info given, used default timer */		if(infoPtr->AccelCount==0 || infoPtr->AccelVect==0) {		    infoPtr->AccelIndex = -1;		    temp = REPEAT_DELAY;		} else {		    infoPtr->AccelIndex = 0; /* otherwise, use it *///.........这里部分代码省略.........
开发者ID:devyn,项目名称:wine,代码行数:101,



注:本文中的GetWindowTheme函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ GetWindowThreadProcessId函数代码示例
C++ GetWindowTextLengthW函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。