API创建窗体,如何消除CreateWindowEx函数的警告(0分)

  • 主题发起人 主题发起人 2ine
  • 开始时间 开始时间
2

2ine

Unregistered / Unconfirmed
GUEST, unregistred user!
代码如此:<br>&nbsp; CreateWindowEx(<br>&nbsp; &nbsp; WS_EX_APPWINDOW, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //扩展的窗口风格.<br>&nbsp; &nbsp; WinClass.lpszClassName, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //类名.<br>&nbsp; &nbsp; '', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //窗口标题.<br>&nbsp; &nbsp; WS_OVERLAPPEDWINDOW, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//窗口风格.<br>&nbsp; &nbsp; CW_USEDEFAULT, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//窗口左上角相对于屏幕左上角的初始位置x.<br>&nbsp; &nbsp; 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//....右y.<br>&nbsp; &nbsp; CW_USEDEFAULT, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//窗口宽度x.<br>&nbsp; &nbsp; 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//窗口高度y.<br>&nbsp; &nbsp; 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//父窗口句柄.<br>&nbsp; &nbsp; 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//窗口菜单句柄.<br>&nbsp; &nbsp; hInst, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//程序实例句柄.<br>&nbsp; &nbsp; nil); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //创建参数指针.<br><br>警告如下:<br>Constant expression violates subrange bounds<br><br>恳请高手解决~没分了,对不住大家
 
解决了,不用CW_USEDEFAULT,自己定义个数就行。
 
其实无所谓,你无视其存在就行了...<br>如果你实在看不过去,可以这样:<br>{$WARNINGS OFF}<br>CreateWindowEx(<br>....<br>nil);<br>{$WARNINGS ON}
 
To 2ine:<br>CW_USEDEFAULT 是 Windows 预设的常数,该用还得用...
 
后退
顶部