当前位置:网站首页>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");
}
边栏推荐
猜你喜欢
随机推荐
Battery modeling, analysis and optimization (Matlab code implementation)
[贴装专题] 贴装流程中涉及到的位置关系计算
元组 字典 集合
IDEA见过就会爱上的超实用快捷键,一键十行!
ORA-00600 [16703], [1403], [20]问题分析及恢复
LeetCode147:对链表进行插入排序 画图分析 思路清晰!
程序员的专属浪漫——用3D Engine 5分钟实现烟花绽放效果
Win系统 - 罗技 G604 鼠标蓝灯闪烁、失灵解决方案
【八大排序②】选择排序(选择排序,堆排序)
【size_t是无符号整数 (-1 > 10) -> 1】
认识
socket实现TCP/IP通信
TELNET协议相关RFC
basic operator
按键精灵之输出文本
蓄电池建模、分析与优化(Matlab代码实现)
xmms的歌词显示及音量控制OK
EndNoteX9 OR X 20 指南
day16_03集合
【八大排序①】插入排序(直接插入排序、希尔排序)