- #include <WINDOWS.H>
- #include <TCHAR.H>
- #include <SETUPAPI.H>
- //#include <SHLWAPI.H>
- #pragma comment(lib, "setupapi.lib")
- //#pragma comment(lib, "shlwapi.lib")
- HDEVINFO hDevInfo = NULL;
- // 出错信息
- void FormatMSG(DWORD dwError, LPTSTR * o)
- {
- LPTSTR oo=(LPTSTR)o;
- BOOL bOk = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, dwError,
- MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), oo, 0, NULL);
- if(!bOk) //将**变成*2007 /01 /10
- { //新建的字符串由oo指向。
- HMODULE hDll = LoadLibraryEx(_T("netmsg.dll"),NULL,DONT_RESOLVE_DLL_REFERENCES);
- if(NULL != hDll)
- {
- FormatMessage(FORMAT_MESSAGE_FROM_HMODULE |
- FORMAT_MESSAGE_FROM_SYSTEM,hDll,
- dwError,
- MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED),
- (LPTSTR)o,0, NULL);
vc++实现控制USB设备启用与否
最新推荐文章于 2020-12-08 15:58:39 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)