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

📄 user.odl

📁 The code for this article was written for version 1.0 of the Active Template Library (ATL). The cu
💻 ODL
📖 第 1 页 / 共 5 页
字号:

[
uuid(54674046-3A82-101B-8181-00AA003743D3),
helpstring("Windows User Functions"),
#ifdef WIN32
dllname("USER32.DLL")
#else
dllname("USER.EXE")
#endif
]
module User {

    #ifndef WIN32
    [
    usesgetlasterror,
    entry("GetTickCount"),
    helpstring("Returns milliseconds since Windows was started"),
    ]
    DWORD   WINAPI GetTickCount(void);

    [
    usesgetlasterror,
    entry("GetFreeSystemResources"),
    helpstring("Gets percentage of free system resources"),
    ]
    UINT WINAPI GetFreeSystemResources([in] UINT fuSysResource);
    #endif

    // ****** System Metrics ********

    [
    usesgetlasterror,
    entry("GetSystemMetrics"),
    helpstring("Get Various system metrics and system configuration settings"),
    ]
    int WINAPI GetSystemMetrics([in] int nIndex);

    [
    usesgetlasterror,
    entry("GetDoubleClickTime"),
    helpstring("Get current double-click time for the mouse"),
    ]
    UINT    WINAPI GetDoubleClickTime(void);

    [
    usesgetlasterror,
    entry("SetDoubleClickTime"),
    helpstring("Sets double-click time for the mouse"),
    ]
    void    WINAPI SetDoubleClickTime([in] UINT uInterval);

    // ****** System Parameters support *********

    /*
    BOOL    WINAPI SystemParametersInfo(UINT, UINT, VOID FAR*, UINT);
    */

    // ****** Rectangle support *****

    /*
    void    WINAPI SetRect(RECT FAR*, int, int, int, int);
    void    WINAPI SetRectEmpty(RECT FAR*);

    void    WINAPI CopyRect(RECT FAR*, const RECT FAR*);

    BOOL    WINAPI IsRectEmpty(const RECT FAR*);

    BOOL    WINAPI EqualRect(const RECT FAR*, const RECT FAR*);

    BOOL    WINAPI IntersectRect(RECT FAR*, const RECT FAR*, const RECT FAR*);
    BOOL    WINAPI UnionRect(RECT FAR*, const RECT FAR*, const RECT FAR*);
    BOOL    WINAPI SubtractRect(RECT FAR*, const RECT FAR*, const RECT FAR*);

    void    WINAPI OffsetRect(RECT FAR*, int, int);
    void    WINAPI InflateRect(RECT FAR*, int, int);

    BOOL    WINAPI PtInRect(const RECT FAR*, POINT);
    */

    // ****** Window class management *******

    /*
    typedef LRESULT (CALLBACK* WNDPROC)(HWND, UINT, WPARAM, LPARAM);

    typedef struct tagWNDCLASS
    {
        UINT        style;
        WNDPROC lpfnWndProc;
        int         cbClsExtra;
        int         cbWndExtra;
        HINSTANCE   hInstance;
        HICON   hIcon;
        HCURSOR hCursor;
        HBRUSH  hbrBackground;
        LPCSTR  lpszMenuName;
        LPCSTR  lpszClassName;
    } WNDCLASS;
    typedef WNDCLASS* PWNDCLASS;
    typedef WNDCLASS NEAR* NPWNDCLASS;
    typedef WNDCLASS FAR* LPWNDCLASS;

    ATOM    WINAPI RegisterClass(const WNDCLASS FAR*);
    BOOL    WINAPI UnregisterClass(LPCSTR, [in] HINSTANCE hInst);

    BOOL    WINAPI GetClassInfo([in] HINSTANCE hInst, LPCSTR, WNDCLASS FAR*);
    */

    [
    #ifdef WIN32
    usesgetlasterror,
    entry("GetClassNameA"),
    #else
    entry("GetClassName"),
    #endif
    helpstring("Copies the class name of a window handle to a string buffer"),
    ]
    int     WINAPI GetClassName([in] HWND hwnd, [in] LPSTR lpszClassName,
                                [in] int cchClassName);

    // Class words

    [
    usesgetlasterror,
    entry("GetClassWord"),
    helpstring("Gets the indexed class WORD data of a window handle (see GWW_ constants)")
    ]
    WORD    WINAPI GetClassWord([in] HWND hwnd, [in] int nIndex);

    [
    usesgetlasterror,
    entry("SetClassWord"),
    helpstring("Sets the indexed class WORD data of a window handle and returns previous data (see GWW_ constants)")
    ]
    WORD    WINAPI SetClassWord([in] HWND hwnd, [in] int nIndex,
                                [in] WORD nValue);

    [
    #ifdef WIN32
    usesgetlasterror,
    entry("GetClassLongA"),
    #else
    entry("GetClassLong"),
    #endif
    helpstring("Gets the indexed class LONG data of a window handle (see GWL_ constants)")
    ]
    LONG    WINAPI GetClassLong([in] HWND hwnd, [in] int nIndex);

    [
    #ifdef WIN32
    usesgetlasterror,
    entry("SetClassLongA"),
    #else
    entry("SetClassLong"),
    #endif
    helpstring("Sets the indexed class LONG data of a window handle and returns previous data (see GWL_ constants)")
    ]
    LONG    WINAPI SetClassLong([in] HWND hwnd, [in] int nIndex,
                                [in] LONG nValue);

    [
    #ifdef WIN32
    usesgetlasterror,
    entry("GetClassLongA"),
    #else
    entry("GetClassWord"),
    #endif
    helpstring("Gets the indexed class data (WORD or LONG depending on environment) of a window handle (see GWD_ constants)")
    ]
    UINT    WINAPI GetClassData([in] HWND hwnd, [in] int nIndex);

    [
    #ifdef WIN32
    usesgetlasterror,
    entry("SetClassLongA"),
    #else
    entry("SetClassWord"),
    #endif
    helpstring("Sets the indexed class data (WORD or LONG depending on environment) of a window handle and returns previous data (see GWD_ constants)")
    ]
    UINT    WINAPI SetClassData([in] HWND hwnd, [in] int nIndex,
                                [in] UINT nValue);

    // ****** Window creation/destroy *******

    [
    usesgetlasterror,
    entry("IsWindow"),
    helpstring("Tells whether a window handle is valid")
    ]
    BOOL    WINAPI IsWindow([in] HWND hwnd);

    /*
    HWND    WINAPI CreateWindowEx(DWORD, [in] LPCSTR lpsz, [in] LPCSTR lpsz, DWORD, int, int, int, int, HWND, [in] HMENU hmenu, [in] HINSTANCE hInst, void FAR*);
    HWND    WINAPI CreateWindow([in] LPCSTR lpsz, [in] LPCSTR lpsz, DWORD, int, int, int, int, HWND, [in] HMENU hmenu, [in] HINSTANCE hInst, void FAR*);

    BOOL    WINAPI DestroyWindow([in] HWND hwnd);
    */

    // Basic window attributes
    #ifndef WIN32
    [
    entry("GetWindowTask"),
    helpstring("Returns the owning task (process) of the given window")
    ]
    HTASK   WINAPI GetWindowTask([in] HWND hwnd);
    #else
    [
    usesgetlasterror,
    entry("GetWindowThreadProcessId"),
    helpstring("Returns the ids of both the process and the thread that created a window")
    ]
    DWORD WINAPI GetWindowThreadProcessId([in] HWND hwnd,
                                          [in, out] DWORD * lpdwProcessId);
    #endif

    [
    usesgetlasterror,
    entry("IsChild"),
    helpstring("Tells whether the given child window is the child of the given parent window")
    ]
    BOOL    WINAPI IsChild([in] HWND hwndParent, [in] HWND hwndChild);

//@B GetParent
    [
    usesgetlasterror,
    entry("GetParent"),
    helpstring("Gets the parent window handle of the given window")
    ]
    HWND    WINAPI GetParent([in] HWND hWnd);
//@E GetParent

    [
    usesgetlasterror,
    entry("SetParent"),
    helpstring("Changes the parent of the given window to the specified new parent")
    ]
    HWND    WINAPI SetParent([in] HWND hwndChild, [in] HWND hwndNewParent);

    [
    usesgetlasterror,
    entry("IsWindowVisible"),
    helpstring("Tells whether a window is visible")
    ]
    BOOL    WINAPI IsWindowVisible([in] HWND hwnd);

    [
    usesgetlasterror,
    entry("ShowWindow"),
    helpstring("Sets a window's visibility state (see SW_ constants)")
    ]
    BOOL    WINAPI ShowWindow([in] HWND hwnd, [in] int nCmdShow);

    // Enabled state

    [
    usesgetlasterror,
    entry("EnableWindow"),
    helpstring("Enables or disables a window")
    ]
    BOOL    WINAPI EnableWindow([in] HWND hwnd, [in] BOOL fEnable);

    [
    usesgetlasterror,
    entry("IsWindowEnabled"),
    helpstring("Tells whether a window is enabled or disabled")
    ]
    BOOL    WINAPI IsWindowEnabled([in] HWND hwnd);

    // Window text

    [
    #ifdef WIN32
    usesgetlasterror,
    entry("SetWindowTextA"),
    #else
    entry("SetWindowText"),
    #endif
    helpstring("Sets the title of a window"),
    ]
    void    WINAPI SetWindowText([in] HWND hwnd, [in] LPCSTR lpsz);

    [
    #ifdef WIN32
    usesgetlasterror,
    entry("GetWindowTextA"),
    #else
    entry("GetWindowText"),
    #endif
    helpstring("Copies no more than cbMax characters of a window title to a string")
    ]
    int     WINAPI GetWindowText([in] HWND hwnd, [in] LPSTR lpsz,
                                 [in] int cbMax);

    [
    #ifdef WIN32
    usesgetlasterror,
    entry("GetWindowTextLengthA"),
    #else
    entry("GetWindowTextLength"),
    #endif
    helpstring("Gets the character length of a window title)")
    ]
    int     WINAPI GetWindowTextLength([in] HWND hwnd);

    // Window words

    [
    usesgetlasterror,
    entry("GetWindowWord"),
    helpstring("Gets the indexed WORD data of a window handle (see GWW_ constants)")
    ]
    WORD    WINAPI GetWindowWord([in] HWND hwnd, [in] int nIndex);

    [
    usesgetlasterror,
    entry("SetWindowWord"),
    helpstring("Sets the indexed WORD data of a window handle and returns previous data (see GWW_ constants)")
    ]
    WORD    WINAPI SetWindowWord([in] HWND hwnd, [in] int nIndex,
                                 [in] WORD nValue);

    [
    #ifdef WIN32
    usesgetlasterror,
    entry("GetWindowLongA"),
    #else
    entry("GetWindowLong"),
    #endif
    helpstring("Gets the indexed LONG data of a window handle (see GWL_ constants)")
    ]
    LONG    WINAPI GetWindowLong([in] HWND hwnd, [in] int nIndex);

    [
    #ifdef WIN32
    usesgetlasterror,
    entry("SetWindowLongA"),
    #else
    entry("SetWindowLong"),
    #endif
    helpstring("Sets the indexed LONG data of a window handle and returns previous data (see GWL_ constants)")
    ]
    LONG    WINAPI SetWindowLong([in] HWND hwnd, [in] int nIndex,
                                 [in] LONG nValue);

    [
    #ifdef WIN32
    usesgetlasterror,
    entry("GetWindowLongA"),
    #else
    entry("GetWindowWord"),
    #endif
    helpstring("Gets the indexed data (WORD or LONG depending on environment) of a window handle (see GWD_ constants)")
    ]
    UINT    WINAPI GetWindowData([in] HWND hwnd, [in] int nIndex);

    [
    #ifdef WIN32
    usesgetlasterror,
    entry("SetWindowLongA"),
    #else
    entry("SetWindowWord"),
    #endif
    helpstring("Sets the indexed data (WORD or LONG depending on environment) of a window handle and returns previous data (see GWD_ constants)")
    ]
    UINT    WINAPI SetWindowData([in] HWND hwnd, [in] int nIndex,
                                 [in] UINT nValue);

    // Window Styles

    // ****** Window size, position, Z-order, and visibility *******

    /* Omit
    void    WINAPI GetClientRect([in] HWND hwnd, RECT FAR*);
    void    WINAPI GetWindowRect([in] HWND hwnd, RECT FAR*);

    typedef struct tagWINDOWPLACEMENT
    {
        UINT  length;
        UINT  flags;
        UINT  showCmd;
        POINT ptMinPosition;
        POINT ptMaxPosition;
        RECT  rcNormalPosition;
    } WINDOWPLACEMENT;
    typedef WINDOWPLACEMENT     *PWINDOWPLACEMENT;
    typedef WINDOWPLACEMENT FAR* LPWINDOWPLACEMENT;

    BOOL    WINAPI GetWindowPlacement([in] HWND hwnd, WINDOWPLACEMENT FAR*);
    BOOL    WINAPI SetWindowPlacement([in] HWND hwnd, const WINDOWPLACEMENT FAR*);
    */

    [
    usesgetlasterror,
    entry("SetWindowPos"),
    helpstring("Changes the window size, position, and z-order of a window")
    ]
    BOOL    WINAPI SetWindowPos([in] HWND hwnd, [in] HWND hwndInsertAfter,
                                [in] int x, [in] int y,
                                [in] int cx, [in] int cy,
                                [in] UINT fuFlags);

    /*
    DECLARE_HANDLE(HDWP);

    HDWP    WINAPI BeginDeferWindowPos(int);
    HDWP    WINAPI DeferWindowPos(HDWP, [in] HWND hwnd, [in] HWND hwnd, int, int, int, int, UINT);
    BOOL    WINAPI EndDeferWindowPos(HDWP);

    BOOL    WINAPI MoveWindow([in] HWND hwnd, int, int, int, int, BOOL);
    BOOL    WINAPI BringWindowToTop([in] HWND hwnd);
    */

    // ****** Window proc implementation & subclassing support *****

    // LRESULT WINAPI DefWindowProc([in] HWND hwnd, UINT, WPARAM, LPARAM);

    [
    usesgetlasterror,
    #if WIN32

⌨️ 快捷键说明

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