从VC ++.NET Win窗体应用程序调用setupapi.h函数 [英] Call setupapi.h functions from VC++.NET win form application

查看:146
本文介绍了从VC ++.NET Win窗体应用程序调用setupapi.h函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从MFC应用程序(GUI女巫通过内核驱动程序将写操作读取到USB设备)迁移到VC ++.NET win窗体应用程序.但是,当我在stdafx.h中包含setupapi.h文件时,会产生以下错误

I am trying to migrate from an MFC application (GUI witch reads write through a kernel driver to a USB device) to a VC++.NET win form application. But when I include the setupapi.h file in the stdafx.h the following errors are produced

1>Compiling...
1>stdafx.cpp
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\setupapi.h(60) : error C2143: syntax error : missing ';' before '*'
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\setupapi.h(60) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\setupapi.h(60) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\spapidef.h(23) : error C2146: syntax error : missing ';' before identifier 'SP_LOG_TOKEN'
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\spapidef.h(23) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\spapidef.h(23) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\commctrl.h(19) : error C2059: syntax error : 'return'
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\prsht.h(97) : error C2065: 'CALLBACK' : undeclared identifier
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\prsht.h(97) : error C2065: 'LPFNPSPCALLBACKA' : undeclared identifier
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\prsht.h(97) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\prsht.h(97) : fatal error C1903: unable to recover from previous error(s); stopping compilation




有帮助吗???
谢谢Nick




any help????
Thanks Nick

推荐答案

我设法通过包含以下标头来解决问题:
I manage to solve the problem by include the following headers:
#include <windows.h>
#include <strsafe.h>
#include <setupapi.h>


关于尼克


Regards Nick


说实话,这超越了善与恶.请参阅我对这个问题的评论.

好的,当它说丢失"时,在编译器期望的地方添加;".让它快乐! :-)
碰到一堵墙之后,请开始思考这种情况,以防万一您之前没有切换此功能(嗯,您实际上不需要添加所有这些'';'').

C ++编译器消息可能会非常令人误解,不要指望快速解决.当您用尽所有可能性而无法解决问题时,请提出一个真实问题.当然,它将需要一些代码. :-)

注意:帮我们一个忙:当您回答时,请跳过我是编程新手"之类的字眼.只是跳过它.这不是借口,或者仅仅是无奈.

—SA
This is beyond good and evil, honestly. Please see my comment to the question.

OK, when it says "missing ;" add '';'' where compiler expects it. Make it happy! :-)
After you hit a brick wall, start thinking at the situation, in case you did not switch this function before (well, you don''t really need to thing to add all those '';'').

C++ compiler messages can be very misleading, don''t expect fast resolution. When you exhausted all your possibilities and fail to sort it out, well, ask a real question. It will need some code, of course. :-)

Note: do all us a favor: when you respond, skip the words "I''m new to programming" and the like. Just skip it. This is not an excuse, or just helpless.

—SA


这篇关于从VC ++.NET Win窗体应用程序调用setupapi.h函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆