当前位置:网站首页>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");
}
边栏推荐
- 【八大排序④】归并排序、不基于比较的排序(计数排序、基数排序、桶排序)
- 自定义类型:结构体,枚举,联合
- [Halcon&定位] 解决Roi区域外的模板匹配成功
- 关于页面初始化
- Secretive present: in modern times
- Apache Log4j 2 远程代码执行漏洞详解
- By asking where the variables are stored, the shepherd boy laughed and said to use pointers, Go lang1.18 introductory refining tutorial, from Bai Ding to Hongru, the use of go lang type pointers (Poin
- Tom Morgan | 人生二十一条法则
- stimulus.js 初体验
- Battery modeling, analysis and optimization (Matlab code implementation)
猜你喜欢
随机推荐
MySQL关于表的知识点,进来学习!
抛出一个问题? Mysql环境下进行Count操作执行的时候速度很慢_需手动给主键添加索引---MySql优化001
StratoVirt 中的虚拟网卡是如何实现的?
antd的Table列选择、列拓展
LeetCode147:对链表进行插入排序 画图分析 思路清晰!
好久没更新博客了
1: bubble sort
xmms的歌词显示及音量控制OK
Browser error classification
【MySQL】mysql因为字符集导致left join出现Using join buffer (Block Nested Loop)
技术分享 | 如何模拟真实使用场景?mock 技术来帮你
多线程案例——定时器
Restful WebServices 学习笔记
Redis cache update strategy actively
实现下拉加载更多
缓存击穿,缓存穿透,缓存雪崩的解释和对应的一些解决方案
MySQL备份与恢复
EndNote User Guide
socket实现TCP/IP通信
第二周作业