UxTheme.dll 的函数原型类型/声明 - 动态加载
Function proto types / declarations for UxTheme.dll -dynamic- loading
使用 c++ Builder 2009,我正在尝试修复代码的 Pre-Theme OS 问题,即 "UxTheme.dll" 在程序启动期间未找到,在 Windows 2000.
这是因为使用了多项功能:
OpenThemeData
DrawThemeBackground
DrawThemeEdge
CloseThemeData
GetThemePartSize
并且因为代码包含 #include <UxTheme.hpp>
(进而包含:#include "uxtheme.h"
)和静态加载 dll 的项目链接 UxTheme.lib
。
我的(初始)目标是在没有此 dll 的 OS 上禁用需要这些功能的功能,但为此我需要动态加载 UxTheme.dll(LoadLibrary()
) 并获取所需函数的地址 (GetProcAddress()
)。
如果无法加载 dll 或函数,我可以禁用该功能或分配我自己的虚拟函数,这样讨厌的启动错误就会消失。
我无法理解函数原型所需的确切语法才能使用 GetProcAddress()
等。所以我的第一个问题是,有人知道 header 文件包含所有这些信息都已经存在,and/or 一个在 public 域中执行函数指针分配的 c(pp) 文件。或者,有人可以给我其中一个函数的 header 和 cpp 语法示例(例如 DrawThemeBackground
),我应该能够弄清楚其余的!那我还包括 <UxTheme.hpp>
吗?
我需要尝试一些错误,但 __stdcall
是我需要的调用约定。我之前尝试过 __cdecl
,但这(显然)没有用。
.h
HTHEME (__stdcall *OpenThemeData)(
HWND hwnd,
LPCWSTR pszClassList
);
HRESULT (__stdcall *GetThemePartSize)(
HTHEME hTheme,
__in_opt HDC hdc,
int iPartId,
int iStateId,
__in_opt LPCRECT prc,
enum THEMESIZE eSize,
__out SIZE *psz
);
HRESULT (__stdcall *DrawThemeBackground)(
HTHEME hTheme,
HDC hdc,
int iPartId,
int iStateId,
LPCRECT pRect,
__in_opt LPCRECT pClipRect
);
HRESULT (__stdcall *DrawThemeEdge)(
HTHEME hTheme,
HDC hdc,
int iPartId,
int iStateId,
LPCRECT pDestRect,
UINT uEdge,
UINT uFlags,
__out_opt LPRECT pContentRect
);
HRESULT (__stdcall * CloseThemeData)(
HTHEME hTheme
);
.cpp
OpenThemeData = (HTHEME (__stdcall *)(
HWND hwnd,
LPCWSTR pszClassList
)) GetProcAddress (DllHandle, "OpenThemeData") ;
GetThemePartSize = (HRESULT (__stdcall *)(
HTHEME hTheme,
__in_opt HDC hdc,
int iPartId,
int iStateId,
__in_opt LPCRECT prc,
enum THEMESIZE eSize,
__out SIZE *psz
)) GetProcAddress (DllHandle, "GetThemePartSize") ;
DrawThemeBackground = (HRESULT (__stdcall *)(
HTHEME hTheme,
HDC hdc,
int iPartId,
int iStateId,
LPCRECT pRect,
__in_opt LPCRECT pClipRect
)) GetProcAddress (DllHandle, "DrawThemeBackground") ;
DrawThemeEdge = (HRESULT (__stdcall *)(
HTHEME hTheme,
HDC hdc,
int iPartId,
int iStateId,
LPCRECT pDestRect,
UINT uEdge,
UINT uFlags,
__out_opt LPRECT pContentRect
)) GetProcAddress (DllHandle, "DrawThemeEdge") ;
CloseThemeData = (HRESULT (__stdcall * )(
HTHEME hTheme
)) GetProcAddress (DllHandle, "CloseThemeData") ;
现在一切正常,在 Win2K 上也是如此
使用 c++ Builder 2009,我正在尝试修复代码的 Pre-Theme OS 问题,即 "UxTheme.dll" 在程序启动期间未找到,在 Windows 2000.
这是因为使用了多项功能:
OpenThemeData
DrawThemeBackground
DrawThemeEdge
CloseThemeData
GetThemePartSize
并且因为代码包含 #include <UxTheme.hpp>
(进而包含:#include "uxtheme.h"
)和静态加载 dll 的项目链接 UxTheme.lib
。
我的(初始)目标是在没有此 dll 的 OS 上禁用需要这些功能的功能,但为此我需要动态加载 UxTheme.dll(LoadLibrary()
) 并获取所需函数的地址 (GetProcAddress()
)。
如果无法加载 dll 或函数,我可以禁用该功能或分配我自己的虚拟函数,这样讨厌的启动错误就会消失。
我无法理解函数原型所需的确切语法才能使用 GetProcAddress()
等。所以我的第一个问题是,有人知道 header 文件包含所有这些信息都已经存在,and/or 一个在 public 域中执行函数指针分配的 c(pp) 文件。或者,有人可以给我其中一个函数的 header 和 cpp 语法示例(例如 DrawThemeBackground
),我应该能够弄清楚其余的!那我还包括 <UxTheme.hpp>
吗?
我需要尝试一些错误,但 __stdcall
是我需要的调用约定。我之前尝试过 __cdecl
,但这(显然)没有用。
.h
HTHEME (__stdcall *OpenThemeData)(
HWND hwnd,
LPCWSTR pszClassList
);
HRESULT (__stdcall *GetThemePartSize)(
HTHEME hTheme,
__in_opt HDC hdc,
int iPartId,
int iStateId,
__in_opt LPCRECT prc,
enum THEMESIZE eSize,
__out SIZE *psz
);
HRESULT (__stdcall *DrawThemeBackground)(
HTHEME hTheme,
HDC hdc,
int iPartId,
int iStateId,
LPCRECT pRect,
__in_opt LPCRECT pClipRect
);
HRESULT (__stdcall *DrawThemeEdge)(
HTHEME hTheme,
HDC hdc,
int iPartId,
int iStateId,
LPCRECT pDestRect,
UINT uEdge,
UINT uFlags,
__out_opt LPRECT pContentRect
);
HRESULT (__stdcall * CloseThemeData)(
HTHEME hTheme
);
.cpp
OpenThemeData = (HTHEME (__stdcall *)(
HWND hwnd,
LPCWSTR pszClassList
)) GetProcAddress (DllHandle, "OpenThemeData") ;
GetThemePartSize = (HRESULT (__stdcall *)(
HTHEME hTheme,
__in_opt HDC hdc,
int iPartId,
int iStateId,
__in_opt LPCRECT prc,
enum THEMESIZE eSize,
__out SIZE *psz
)) GetProcAddress (DllHandle, "GetThemePartSize") ;
DrawThemeBackground = (HRESULT (__stdcall *)(
HTHEME hTheme,
HDC hdc,
int iPartId,
int iStateId,
LPCRECT pRect,
__in_opt LPCRECT pClipRect
)) GetProcAddress (DllHandle, "DrawThemeBackground") ;
DrawThemeEdge = (HRESULT (__stdcall *)(
HTHEME hTheme,
HDC hdc,
int iPartId,
int iStateId,
LPCRECT pDestRect,
UINT uEdge,
UINT uFlags,
__out_opt LPRECT pContentRect
)) GetProcAddress (DllHandle, "DrawThemeEdge") ;
CloseThemeData = (HRESULT (__stdcall * )(
HTHEME hTheme
)) GetProcAddress (DllHandle, "CloseThemeData") ;
现在一切正常,在 Win2K 上也是如此