#if WINVER5 的作用

turnmissile 2006-07-12 09:22:42
我看到一些结构定义如下:
[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#中是什么样的呢?

...全文
208 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
turnmissile 2006-08-09
  • 打赏
  • 举报
回复
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.
Knight94 2006-07-26
  • 打赏
  • 举报
回复
参看
http://blog.csdn.net/Knight94/archive/2006/06/18/809479.aspx
noway8881 2006-07-25
  • 打赏
  • 举报
回复
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxv_w32.h
turnmissile 2006-07-25
  • 打赏
  • 举报
回复
真的没有人能够帮忙吗?
唉,郁闷啊!最后再顶一次,没有就当散分贴算了。
turnmissile 2006-07-17
  • 打赏
  • 举报
回复
没有人知道吗?希望高手指点。
turnmissile 2006-07-12
  • 打赏
  • 举报
回复
另外,如果要自己定义,如何确定当前的版本号?
包括WINVER4, WINVER5, WINVER501

111,093

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧