⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 comctl.odl

📁 The code for this article was written for version 1.0 of the Active Template Library (ATL). The cu
💻 ODL
字号:
#ifdef WIN32
[
uuid(54674056-3A82-101B-8181-00AA003743D3),
helpstring("Common Controls"),
dllname("COMCTL32")
]
module CommonControl {

    //====== IMAGE APIS ========

    const DWORD CLR_NONE            = 0xFFFFFFFF;
    const DWORD CLR_DEFAULT         = 0xFF000000;

    const UINT ILC_MASK             = 0x0001;
    const UINT ILC_COLOR            = 0x0000;
    const UINT ILC_COLORDDB         = 0x00FE;
    const UINT ILC_COLOR4           = 0x0004;
    const UINT ILC_COLOR8           = 0x0008;
    const UINT ILC_COLOR16          = 0x0010;
    const UINT ILC_COLOR24          = 0x0018;
    const UINT ILC_COLOR32          = 0x0020;
    const UINT ILC_PALETTE          = 0x0800;

    [
    usesgetlasterror,
    entry("ImageList_Create"),
    helpstring("Creates a new image list"),
    ]
    HIMAGELIST WINAPI ImageList_Create([in] int cx, [in] int cy,
                                       [in] UINT flags,
                                       [in] int cInitial,
                                       [in] int cGrow);

    [
    usesgetlasterror,
    entry("ImageList_Destroy"),
    helpstring("Destroys an image list"),
    ]
    BOOL WINAPI ImageList_Destroy([in] HIMAGELIST himl);

    [
    usesgetlasterror,
    entry("ImageList_GetImageCount"),
    helpstring("Gets the number of images in an image list"),
    ]
    int WINAPI ImageList_GetImageCount([in] HIMAGELIST himl);

    [
    usesgetlasterror,
    entry("ImageList_Add"),
    helpstring("Adds an image or images to an image list"),
    ]
    int WINAPI ImageList_Add([in] HIMAGELIST himl,
                             [in] HBITMAP hbmImage,
                             [in] HBITMAP hbmMask);

    [
    usesgetlasterror,
    entry("ImageList_ReplaceIcon"),
    helpstring("Replaces an image with an icon or cursor"),
    ]
    int WINAPI ImageList_ReplaceIcon([in] HIMAGELIST himl,
                                     [in] int i,
                                     [in] HICON hicon);

    [
    usesgetlasterror,
    entry("ImageList_SetBkColor"),
    helpstring("Sets the image list background color"),
    ]
    COLORREF WINAPI ImageList_SetBkColor([in] HIMAGELIST himl,
                                         [in] COLORREF clrBk);

    [
    usesgetlasterror,
    entry("ImageList_GetBkColor"),
    helpstring("Gets the image list background color"),
    ]
    COLORREF WINAPI ImageList_GetBkColor([in] HIMAGELIST himl);

    [
    usesgetlasterror,
    entry("ImageList_SetOverlayImage"),
    helpstring("Adds the index of an image to the list of images to be used as overlay masks"),
    ]
    BOOL WINAPI ImageList_SetOverlayImage([in] HIMAGELIST himl,
                                          [in] int iImage,
                                          [in] int iOverlay);

    // #define ImageList_AddIcon(himl, hicon) \
    //         ImageList_ReplaceIcon(himl, -1, hicon)

    const UINT ILD_NORMAL           = 0x0000;
    const UINT ILD_TRANSPARENT      = 0x0001;
    const UINT ILD_MASK             = 0x0010;
    const UINT ILD_IMAGE            = 0x0020;
    const UINT ILD_BLEND25          = 0x0002;
    const UINT ILD_BLEND50          = 0x0004;
    const UINT ILD_OVERLAYMASK      = 0x0F00;

    // #define INDEXTOOVERLAYMASK(i)    ((i) << 8)

    const UINT ILD_SELECTED         = 0x0004;
    const UINT ILD_FOCUS            = 0x0004;
    const UINT ILD_BLEND            = 0x0F00;
    const DWORD CLR_HILIGHT         = 0xFF000000; // -16777216;

    [
    usesgetlasterror,
    entry("ImageList_Draw"),
    helpstring("Draws an image list item in the specified device context"),
    ]
    BOOL WINAPI ImageList_Draw([in] HIMAGELIST himl,
                               [in] int i, [in] HDC hdcDst,
                               [in] int x, [in] int y,
                               [in] UINT fStyle);

    [
    usesgetlasterror,
    entry("ImageList_Replace"),
    helpstring("Replaces an image in an image list with a new image"),
    ]
    BOOL WINAPI ImageList_Replace([in] HIMAGELIST himl,
                                  [in] int i,
                                  [in] HBITMAP hbmImage,
                                  [in] HBITMAP hbmMask);

    [
    usesgetlasterror,
    entry("ImageList_AddMasked"),
    helpstring("Adds an image or images to an image list, generating a mask from the specified bitmap"),
    ]
    int WINAPI ImageList_AddMasked([in] HIMAGELIST himl,
                                   [in] HBITMAP hbmImage,
                                   [in] COLORREF crMask);

    [
    usesgetlasterror,
    entry("ImageList_DrawEx"),
    helpstring("Draws an image list item in the specified device context using the given drawing style and color"),
    ]
    BOOL WINAPI ImageList_DrawEx([in] HIMAGELIST himl,
                                 [in] int i, [in] HDC hdcDst,
                                 [in] int x, [in] int y,
                                 [in] int dx, [in] int dy,
                                 [in] COLORREF rgbBk,
                                 [in] COLORREF rgbFg,
                                 [in] UINT fStyle);

    [
    usesgetlasterror,
    entry("ImageList_Remove"),
    helpstring("Removes an image from an image list"),
    ]
    BOOL WINAPI ImageList_Remove([in] HIMAGELIST himl, [in] int i);

    [
    usesgetlasterror,
    entry("ImageList_GetIcon"),
    helpstring("Creates an icon or cursor based on an image and mask in an image list"),
    ]
    HICON WINAPI ImageList_GetIcon([in] HIMAGELIST himl,
                                   [in] int i, [in] UINT flags);

    [
    usesgetlasterror,
    entry("ImageList_LoadImageA"),
    helpstring("Creates an image list from the specified bitmap, cursor, or icon resource"),
    ]
    HIMAGELIST WINAPI ImageList_LoadImage([in] HINSTANCE hi,
                                          [in] LPCSTR lpbmp,
                                          [in] int cx, [in] int cGrow,
                                          [in] COLORREF crMask,
                                          [in] UINT uType, [in] UINT uFlags);

    [
    usesgetlasterror,
    entry("ImageList_BeginDrag"),
    helpstring("Begins dragging an image"),
    ]
    BOOL WINAPI ImageList_BeginDrag([in] HIMAGELIST himlTrack,
                                    [in] int iTrack,
                                    [in] int dxHotspot,
                                    [in] int dyHotspot);

    [
    usesgetlasterror,
    entry("ImageList_EndDrag"),
    helpstring("Ends a drag operation"),
    ]
    void WINAPI ImageList_EndDrag();

    [
    usesgetlasterror,
    entry("ImageList_DragEnter"),
    helpstring("Updates the specified window during a drag operation and displays the drag image at the specified position"),
    ]
    BOOL WINAPI ImageList_DragEnter([in] HWND hwndLock,
                                    [in] int x, [in] int y);

    [
    usesgetlasterror,
    entry("ImageList_DragLeave"),
    helpstring("Unlocks the specified window and hides the drag image, allowing the window to be updated"),
    ]
    BOOL WINAPI ImageList_DragLeave([in] HWND hwndLock);

    [
    usesgetlasterror,
    entry("ImageList_DragMove"),
    helpstring("Moves the image that is being dragged during a drag-and-drop operation"),
    ]
    BOOL WINAPI ImageList_DragMove([in] int x, [in] int y);

    [
    usesgetlasterror,
    entry("ImageList_SetDragCursorImage"),
    helpstring("Creates a new drag image by combining the specified image (typically a cursor) with the current drag image"),
    ]
    BOOL WINAPI ImageList_SetDragCursorImage([in] HIMAGELIST himlDrag,
                                             [in] int iDrag,
                                             [in] int dxHotspot,
                                             [in] int dyHotspot);

    [
    usesgetlasterror,
    entry("ImageList_DragShowNolock"),
    helpstring("Shows or hides the image being dragged"),
    ]
    BOOL        WINAPI ImageList_DragShowNolock([in] BOOL fShow);

    [
    usesgetlasterror,
    entry("ImageList_GetDragImage"),
    helpstring("Retrieves temporary drag image list, position, and offset"),
    ]
    HIMAGELIST  WINAPI ImageList_GetDragImage([out] int FAR * ppt,
                                              [out] int FAR* pptHotspot);

    // #define  ImageList_RemoveAll(himl)
    //          ImageList_Remove(himl, -1)
    // #define  ImageList_ExtractIcon(hi, himl, i)
    //          ImageList_GetIcon(himl, i, 0)
    // #define  ImageList_LoadBitmap(hi, lpbmp, cx, cGrow, crMask)
    //          ImageList_LoadImage(hi, lpbmp, cx, cGrow, crMask, IMAGE_BITMAP, 0)

    #ifdef __IStream_INTERFACE_DEFINED__

    [
    usesgetlasterror,
    entry("ImageList_Read"),
    helpstring("Reads an image list from a stream"),
    ]
    HIMAGELIST WINAPI ImageList_Read([in] LPSTREAM pstm);

    [
    usesgetlasterror,
    entry("ImageList_Write"),
    helpstring("Writes an image list to a stream"),
    ]
    BOOL WINAPI ImageList_Write([in] HIMAGELIST himl,
                                [in] LPSTREAM pstm);

    #endif

    /*
    typedef struct _IMAGEINFO
    {
        HBITMAP hbmImage;
        HBITMAP hbmMask;
        int     Unused1;
        int     Unused2;
        RECT    rcImage;
    } IMAGEINFO;
    */

    [
    usesgetlasterror,
    entry("ImageList_GetIconSize"),
    helpstring("Gets the dimensions of images in an image list"),
    ]
    BOOL WINAPI ImageList_GetIconSize([in] HIMAGELIST himl,
                                      [out] int FAR * cx,
                                      [out] int FAR *cy);

    [
    usesgetlasterror,
    entry("ImageList_SetIconSize"),
    helpstring("Sets the dimensions of images in an image list"),
    ]
    BOOL WINAPI ImageList_SetIconSize([in] HIMAGELIST himl,
                                      [in] int cx, [in] int cy);

    /*
    [
    usesgetlasterror,
    entry("ImageList_GetImageInfo"),
    helpstring("Gets information about an image"),
    ]
    BOOL WINAPI ImageList_GetImageInfo([in] HIMAGELIST himl,
                                       [in] int i,
                                       IMAGEINFO FAR* pImageInfo);
    */

    [
    usesgetlasterror,
    entry("ImageList_Merge"),
    helpstring("Creates a new image by combining two existing images, and stores it in a new image list"),
    ]
    HIMAGELIST WINAPI ImageList_Merge([in] HIMAGELIST himl1, [in] int i1,
                                      [in] HIMAGELIST himl2, [in] int i2,
                                      [in] int dx, [in] int dy);

    //====== ANIMATE CONTROL =======

    const LPSTR ANIMATE_CLASS       = "SysAnimate32";

    const UINT ACS_CENTER           = 0x0001;
    const UINT ACS_TRANSPARENT      = 0x0002;
    const UINT ACS_AUTOPLAY         = 0x0004;


    const UINT ACM_OPENA            = WM_USER + 100;
    const UINT ACM_OPEN             = WM_USER + 100;

    const UINT ACM_PLAY             = WM_USER + 101;
    const UINT ACM_STOP             = WM_USER + 102;


    const UINT ACN_START            = 1;
    const UINT ACN_STOP             = 2;


    /*
    #define Animate_Create(hwndP, id, dwStyle, hInstance)  \
             CreateWindow(ANIMATE_CLASS, NULL,          \
                          dwStyle, 0, 0, 0, 0, hwndP, (HMENU)(id), \
                          hInstance, NULL)

    #define Animate_Open(hwnd, szName)
             (BOOL)SendMessage(hwnd, ACM_OPEN, 0, \
             (LPARAM)(LPTSTR)(szName))

    #define Animate_Play(hwnd, from, to, rep) \
             (BOOL)SendMessage(hwnd, ACM_PLAY, (WPARAM)(UINT)(rep), \
             (LPARAM)MAKELONG(from, to))

    #define Animate_Stop(hwnd) \
             (BOOL)SendMessage(hwnd, ACM_STOP, 0, 0)

    #define Animate_Close(hwnd) \
             Animate_Open(hwnd, NULL)

    #define Animate_Seek(hwnd, frame) \
             Animate_Play(hwnd, frame, frame, 1)

    */
}
#endif // Win32

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -