中文路径问题?路径有中文不成功,但是如果都是英文的话就成功了《这是为什么啊?
#include<stdio.h>
#include<Windows.h>
#include<Winbase.h>
#pragma comment(lib,"version.lib")
void getfileinfo(WCHAR* Msg);
void main()
{ WCHAR a[]=L"E:\\迅雷\\Program\\DoctorService";
getfileinfo(a);
getmodiftime(a);
}
void getfileinfo(WCHAR* Msg)
//转化wchar 位char
{
//获取文件信息
DWORD ll;
DWORD fileinfolong=GetFileVersionInfoSize(Msg,&ll);
LPVOID pBuf=malloc(fileinfolong);
if(GetFileVersionInfo(Msg,0,fileinfolong,pBuf))
{ WCHAR SubBlock[255]=L""; DWORD i=0;TCHAR* lpBuffer;
UINT dwBytes=0;
struct LANGANDCODEPAGE{
WORD wLanguage;
WORD wCodePage;
}*lpTranslate;
// Read the list of languages and code pages.
DWORD cbTranslate = 0;
VerQueryValue(pBuf,TEXT("\\VarFileInfo\\Translation"),(LPVOID*)&lpTranslate,(PUINT)&cbTranslate);
// Read the file description for each language and code page.
for(i=0;i<(cbTranslate/sizeof(struct LANGANDCODEPAGE));i++ )
{ wsprintf(SubBlock,
TEXT("\\StringFileInfo\\%04x%04x\\FileDescription"),
lpTranslate[i].wLanguage,
lpTranslate[i].wCodePage);
// Retrieve file description for language and code page "i".
VerQueryValue(pBuf,SubBlock,(LPVOID*)&lpBuffer,&dwBytes);
//打印出文件公司
printf("文件描述%ws\n",lpBuffer);
}
}
}
#include<Windows.h>
#include<Winbase.h>
#pragma comment(lib,"version.lib")
void getfileinfo(WCHAR* Msg);
void main()
{ WCHAR a[]=L"E:\\迅雷\\Program\\DoctorService";
getfileinfo(a);
getmodiftime(a);
}
void getfileinfo(WCHAR* Msg)
//转化wchar 位char
{
//获取文件信息
DWORD ll;
DWORD fileinfolong=GetFileVersionInfoSize(Msg,&ll);
LPVOID pBuf=malloc(fileinfolong);
if(GetFileVersionInfo(Msg,0,fileinfolong,pBuf))
{ WCHAR SubBlock[255]=L""; DWORD i=0;TCHAR* lpBuffer;
UINT dwBytes=0;
struct LANGANDCODEPAGE{
WORD wLanguage;
WORD wCodePage;
}*lpTranslate;
// Read the list of languages and code pages.
DWORD cbTranslate = 0;
VerQueryValue(pBuf,TEXT("\\VarFileInfo\\Translation"),(LPVOID*)&lpTranslate,(PUINT)&cbTranslate);
// Read the file description for each language and code page.
for(i=0;i<(cbTranslate/sizeof(struct LANGANDCODEPAGE));i++ )
{ wsprintf(SubBlock,
TEXT("\\StringFileInfo\\%04x%04x\\FileDescription"),
lpTranslate[i].wLanguage,
lpTranslate[i].wCodePage);
// Retrieve file description for language and code page "i".
VerQueryValue(pBuf,SubBlock,(LPVOID*)&lpBuffer,&dwBytes);
//打印出文件公司
printf("文件描述%ws\n",lpBuffer);
}
}
}
...全文
相关推荐
python为什么会环境变量设置不成功
在本篇文章里小编给大家分享的是一篇关于python环境变量设置不成功怎么办的解决方法内容,有兴趣的朋友们可以跟着学习下。
Java 解决中文路径问题
NULL 博文链接:https://snailzhang-126-com.iteye.com/blog/512442
解决python cv2.imread 读取中文路径的图片返回为None的问题
主要介绍了解决python cv2.imread 读取中文路径的图片返回为None的问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
成功将Win7 pro 英文版变成中文版
成功将Win7 pro 英文版变成中文版
中文路径导致unitpngfix.js不正常的解决方法
本篇文章是对中文路径导致unitpngfix.js不正常的解决方法进行了详细的分析介绍,需要的朋友参考下


进程/线程/DLL
