我看到一些结构定义如下:
[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#中是什么样的呢?
[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#中是什么样的呢?
解决方案 »
- web中无法调用dll中的方法,求大神分析原因
- 大家好,怎样在picturebox里的图片上画任意图形?
- C# this关键字与VB me关键字
- 暂停程序10秒再继续执行,请高手进
- Windows Media Player控件里怎么判断一首歌已经放完了
- 关于后台输出脚本的问题
- 请问WINFORM中,DATAGRID如果不和数据源绑定该怎么用?类似网页中的TABLE,可以吗?
- 请问高手这样如何处理:我想获得.Net的系统目录的位置,怎样获得
- 数据库能附加后的问题
- 如何让一个button透明的显示它下面的那个picturebox的图片?
- 用DataSet取Excel中的数据时,数据项以0开头的为何读不进阿?如何才能读进,盼望赐教!
- 求解C#中类与派生类实例化后的内存结构图
包括WINVER4, WINVER5, WINVER501
http://blog.csdn.net/Knight94/archive/2006/06/18/809479.aspx
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.