求助,想写个获取文件版本号的小程序,出的错误不知如何解决
void CTestDlg::OnOK()
{
CFileDialog dlg(TRUE,"dll",NULL,OFN_HIDEREADONLY,"*.*||",this);
if (dlg.DoModal())
{
UINT size=0;
LPVOID ipBuf=NULL;
DWORD temp=0;
DWORD *StrVer = &temp;
CString str,len;
str=dlg.GetPathName();
len=GetFileVersionInfoSize(&str,StrVer);
char* idData=new char[len];
if(GetFileVersionInfoW(str,NULL,len,*idData))
{
VerQueryValue(idData,TEXT("\\StringFileInfo\\040904b0\\FileVersion"),&ipBuf,&size);
CString ver = (char*)ipBuf;
delete []idData;
SetDlgItemText(IDC_STATIC,ver);
}
一编译就产生这三个错误:;
C:\Program Files\Microsoft Visual Studio\MyProjects\test\testDlg.cpp(184) : error C2664: 'GetFileVersionInfoSizeA' : cannot convert parameter 1 from 'class CString *' to 'char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Program Files\Microsoft Visual Studio\MyProjects\test\testDlg.cpp(185) : error C2440: 'initializing' : cannot convert from 'class CString' to 'int'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Program Files\Microsoft Visual Studio\MyProjects\test\testDlg.cpp(186) : error C2664: 'GetFileVersionInfoW' : cannot convert parameter 1 from 'class CString' to 'unsigned short *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Error executing cl.exe.