我看到一些结构定义如下:
[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Auto)]
public struct RasEntryName 

public int dwSize; 
[MarshalAs(UnmanagedType.ByValTStr,SizeConst=(int)RasFieldSizeConstants.RAS_MaxEntryName + 1)]
public string szEntryName; 
#if WINVER5
public int dwFlags;
[MarshalAs(UnmanagedType.ByValTStr,SizeConst=260+1)]
public string szPhonebookPath;
#endif
}请问这个WINVER应该自己手动通过#defing去定义吗?还是系统会自动根据windows版本赋值?这种定义在c++下是从系统头文件中获取的,可是c#中是什么样的呢?

解决方案 »

  1.   

    另外,如果要自己定义,如何确定当前的版本号?
    包括WINVER4, WINVER5, WINVER501
      

  2.   

    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxv_w32.h
      

  3.   

    参看
    http://blog.csdn.net/Knight94/archive/2006/06/18/809479.aspx
      

  4.   

    I have got the answer:
    In C#, there is not system define for WINVER4, WINVER5, WINVER501. It is different from C++. We need define them based on your opertion system.
    If it is Win98 system, WINVER4 should be defined. If it is Win2000 system, WINVER5 should be defined. And WINVER501 should be defined if it is WinXP system. 
    The name is not these three macro is not consolide. You can name them as you wise. These three macro can be used to indicate different operation system.Note: #define XXX should locate at the top of files.