- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个由 VS2010 生成的通用 SDI 应用程序,我想用它来测试 WinUsb API。我安装了当前版本的 WDK。根据我在其他地方阅读的帖子,我应该能够设置 VS2010 项目包含路径以指向 WDK 并添加 include WinUsb.h 来执行此操作。所以我将它添加到 stdafx.h 中,如下所示
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <Winusb.h>
但是当我编译时出现错误
1>c:\winddk\7600.16385.1\inc\api\usb200.h(93): error C2332: 'struct' : missing tag name
1>c:\winddk\7600.16385.1\inc\api\usb200.h(93): error C2011: '<unnamed-tag>' : 'enum' type redefinition
1> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\htmlhelp.h(331) : see declaration of '<unnamed-tag>'
1>c:\winddk\7600.16385.1\inc\api\usb200.h(93): error C2059: syntax error : 'constant'
1>c:\winddk\7600.16385.1\inc\api\usb200.h(93): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
它提示的结构是
typedef union _USB_HIGH_SPEED_MAXPACKET {
struct _MP {
USHORT MaxPacket:11; /* 0..10 */
USHORT HSmux:2; /* 11..12 */
USHORT Reserved:3; /* 13..15 */
};
USHORT us;
} USB_HIGH_SPEED_MAXPACKET, *PUSB_HIGH_SPEED_MAXPACKET;
并且 IDE 已经在 _MP 下划了红色下划线。
最佳答案
当应用配置为使用 MBCS 时,问题的根源就出现了。在mbctype.h
中,选择MBCS时包含的是一组#define
语句
/* bit masks for MBCS character types */
#define _MS 0x01 /* MBCS single-byte symbol */
#define _MP 0x02 /* MBCS punct */
#define _M1 0x04 /* MBCS 1st (lead) byte */
#define _M2 0x08 /* MBCS 2nd byte*/
#define _SBUP 0x10 /* SBCS upper char */
#define _SBLOW 0x20 /* SBCS lower char */
发生在包含 usb200.h
之前。您可以不选择 MBCS(通过使用 Unicode),也可以像 Lynn 所说的那样在上面的行中选择 #undef
。但将 #include
放在列表底部附近以避免意外后果。
关于c++ - #include <WinUsb.h> 在 MFC 应用程序中产生编译器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30671389/
我有一个 MFC 项目,它链接到第三方 dll。在程序退出时,IDE 会报告“检测到内存泄漏!”并倾倒泄漏物。 这些泄漏来自第三方 dll。我很确定这些是错误的报道。 (Google 的快速检查表明
首先我想要的是:能够显示具有多列的网格,每个单元格都有一个自定义渲染回调。因此,您可以使用这样的控件在游戏中显示您的库存,或者类似于 Google Chrome 中的行为,它会显示您访问的热门页面的网
在新的 MFC 功能(功能包)中,菜单出现在三个地方: 在菜单栏中 (CMFCMenuBar) 在弹出菜单中 (CMFCPopupMenu) 在 CMFCButton 的“下拉菜单”版本中 我想在所有
在我的 MFC 项目中,我想动态生成标签。例如:我必须为它们生成 4 个编辑控件和相应的标签——比如“Label1”“Label2”...... CStatic *label[MAX_THREAD];
我有第一个对话框,上面有一个简单的按钮,单击该按钮时,使用 CDialog::Create(IDD,this) 创建了第二个对话框。我希望在销毁第二个对话框但不向第二个对话框添加任何代码时通知父级,即
我们的代码库中的添加到剪贴板代码非常低级 - 分配全局内存等等。对于简单的情况,我只想将一些纯文本放在剪贴板上,是否有任何例程可以包装所有这些内容? 一个例子是 CRichEditCtrl 具有 Co
我对 mfc 中事件和消息之间的区别有点困惑。 他们是一样的吗? 最佳答案 由于您专门询问 MFC,我假设您指的是可以在 MFC 类的属性窗口中定义的事件处理程序和消息处理程序。 在“事件”下,您可以
如何以编程方式检测我的 MFC 应用程序当前是否正在显示模式对话框或属性表?目前我正在使用以下内容,但我觉得该代码也会触发无模式对话框。 bool HasModalDialog(const CWnd*
我有两个按钮: 单选按钮:“十六进制” 按钮:“A” 我想在用户选中“十六进制”按钮时启用“A”(“A”在创建时的状态为“禁用”),我该怎么做?谢谢大家。 最佳答案 您需要使用 CButton 's
通常情况下,窗口的厚度为 4 个像素,可以通过 GetSystemMetrics 方法获取。我可以更改它的值,例如 2 个像素吗? 非常感谢! 最佳答案 简单的回答:不。不适用于特定窗口。 复杂的答案
我需要打开一个从同一个类实例化的对话框两次。当我尝试这个时 CdelmeDlg dlg; dlg.DoModal(); dlg.DoModal(); 第二个调用只打开对话框一瞬间,然后关闭。我敢打赌消
如何通过代码在 mfc 中减少标题栏的窗口? 最佳答案 用: ModifyStyle (WS_CAPTION, 0); // to hide ModifyStyle (0, WS_CAPTION);
我使用 AfxMessageBox 关键字显示消息框。基本的东西。 但是,由于路径的长度,它显示如下: 有什么方法可以阻止它以这种方式自动换行吗? 抱歉,如果这是一个愚蠢的问题。但如果我只有一个句子,
所以,我有一个 MFC 程序的插件。我正在使用鼠标事件 Hook (来自 SetWindowsHookEx)来捕获点击。主机应用程序可以打开任意数量的(可能重叠的)子窗口,但我只想拦截特定子窗口中的点
我正在尝试将图像添加到现有按钮..我在一定程度上做到了这一点,问题是我可以添加一个所有者绘制的图像,但无法添加我想要的确切图像..示例见下文代码 CButton* pBtn= (CButton*)Ge
我想在对话框的标题栏上放置一些控件。一种可能的解决方案是,我只是从对话框中删除标题栏并绘制自己的标题栏。 但是如果我自己画标题栏,标题栏的外观不会根据窗口的主题而改变。而且我也不得不忍受接近、最小化和
我已经使用 MinGW 开发了 WinAPI 应用程序,没有问题。现在,我可以用 MFC 做同样的事情吗? 最佳答案 你不能。 MFC 代表 Microsoft Foundation Classes,
(我正在使用VS ++ 2005) 我在对话框上放置了编辑框控件(ID为ID_edit_box),并为其关联了两个变量(使用处理程序向导):控件(c_editbox)和值(v_editbox)变量。我
我有一个自定义 MFC 对话框 CMyDialog,使用资源编辑器添加了一个类型为 CMyControl 的自定义控件 - 该对话框有一个控件的成员变量并且有 DDX设置。 该控件正在接收绘制消息,并
直到现在,我从未真正需要我正在开发的大型 MFC(如果重要,则为单文档界面)应用程序的 Winapp ExitInstance()。但现在我这样做了,主要是为了清理内存分配、卸载一些 DLL 等。好吧
我是一名优秀的程序员,十分优秀!