当前位置:网站首页>Win32控件------------显示系统使用的控件版本
Win32控件------------显示系统使用的控件版本
2022-08-09 10:09:00 【我有梦之翼】
#include <windows.h>
#include <windef.h>
#include <winbase.h>
#include <shlwapi.h>
#include<stdio.h>
#define PACKVERSION(major,minor) MAKELONG(minor,major)
DWORD GetVersion(LPCTSTR lpszDllName)
{
HINSTANCE hinstDll;
DWORD dwVersion = 0;
// For security purposes, LoadLibrary should be provided with a fully qualified
// path to the DLL. The lpszDllName variable should be tested to ensure that it
// is a fully qualified path before it is used.
hinstDll = LoadLibrary(lpszDllName);
if(hinstDll)
{
DLLGETVERSIONPROC pDllGetVersion;
pDllGetVersion = (DLLGETVERSIONPROC)GetProcAddress(hinstDll, "DllGetVersion");
// Because some DLLs might not implement this function, you must test for
// it explicitly. Depending on the particular DLL, the lack of a DllGetVersion
// function can be a useful indicator of the version.
if(pDllGetVersion)
{
DLLVERSIONINFO dvi;
HRESULT hr;
ZeroMemory(&dvi, sizeof(dvi));
dvi.cbSize = sizeof(dvi);
hr = (*pDllGetVersion)(&dvi);
if(SUCCEEDED(hr))
{
dwVersion = PACKVERSION(dvi.dwMajorVersion, dvi.dwMinorVersion);
}
}
FreeLibrary(hinstDll);
}
return dwVersion;
}
void main()
{
LPCTSTR lpszDllName = TEXT("C:\\Windows\\System32\\ComCtl32.dll");
DWORD dwVer = GetVersion(lpszDllName);
printf("Version:%X\n",dwVer);
system("pause");
}
边栏推荐
猜你喜欢
随机推荐
stimulus.js 初体验
《刷题日记》2
单元测试2之实际结果检查的引用
The GNU Privacy Guard
3D打印了这个杜邦线理线神器,从此桌面再也不乱了
需求侧电力负荷预测(Matlab代码实现)
[贴装专题] 基于多目视觉的手眼标定
MySQL备份与恢复
【ASM】字节码操作 MethodVisitor 案例实战 生成对象
Sweet alert
Technology Sharing | Sending Requests Using cURL
Attentional Feature Fusion
【size_t是无符号整数 (-1 > 10) -> 1】
Qt 国际化翻译
技术分享 | 如何模拟真实使用场景?mock 技术来帮你
Practical skills: a key for image information in the Harbor, quick query image
Battery modeling, analysis and optimization (Matlab code implementation)
函数组件和类组件和dva视图更新问题
认识
Tom Morgan | Twenty-One Rules of Life