⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 enumser.h

📁 setupapi方式列举本机串口
💻 H
字号:
/*
Module : ENUMSER.H
Purpose: Defines the interface for a class to enumerate the serial ports installed on a PC
         using a number of different approaches
Created: PJN / 03-11-1998

Copyright (c) 1998 - 2007 by PJ Naughter.  (Web: www.naughter.com, Email: pjna@naughter.com)

All rights reserved.

Copyright / Usage Details:

You are allowed to include the source code in any product (commercial, shareware, freeware or otherwise) 
when your product is released in binary form. You are allowed to modify the source code in any way you want 
except you cannot modify the copyright details at the top of each module. If you want to distribute source 
code with your application, then you are only allowed to distribute versions released by the author. This is 
to maintain a single distribution point for the source code. 

*/


///////////////////////// Macros / Structs etc ////////////////////////////////

#pragma once

#ifndef __ENUMSER_H__
#define __ENUMSER_H__

#ifndef CENUMERATESERIAL_EXT_CLASS
#define CENUMERATESERIAL_EXT_CLASS
#endif

#ifndef CENUMERATESERIAL_EXT_API
#define CENUMERATESERIAL_EXT_API
#endif


///////////////////////// Includes ////////////////////////////////////////////                      

#ifndef __AFXTEMPL_H__
#pragma message("To avoid this message, please put afxtempl.h in your pre compiled header (normally stdafx.h)")
#include <afxtempl.h>
#endif


///////////////////////// Classes /////////////////////////////////////////////

class CENUMERATESERIAL_EXT_CLASS CEnumerateSerial
{
public:
#ifndef NO_ENUMSERIAL_USING_CREATEFILE
  static BOOL UsingCreateFile(CUIntArray& ports);
#endif

#ifndef NO_ENUMSERIAL_USING_QUERYDOSDEVICE
  static BOOL UsingQueryDosDevice(CUIntArray& ports);
#endif

#ifndef NO_ENUMSERIAL_USING_GETDEFAULTCOMMCONFIG
  static BOOL UsingGetDefaultCommConfig(CUIntArray& ports);
#endif

#ifndef NO_ENUMSERIAL_USING_SETUPAPI1
  static BOOL UsingSetupAPI1(CUIntArray& ports, CStringArray& sFriendlyNames);
#endif

#ifndef NO_ENUMSERIAL_USING_SETUPAPI2
  static BOOL UsingSetupAPI2(CUIntArray& ports, CStringArray& sFriendlyNames);
#endif

#ifndef NO_ENUMSERIAL_USING_ENUMPORTS
  static BOOL UsingEnumPorts(CUIntArray& ports);
#endif

#ifndef NO_ENUMSERIAL_USING_WMI
  static BOOL UsingWMI(CUIntArray& ports, CStringArray& sFriendlyNames);
#endif

protected:
  static BOOL IsNumeric(LPCTSTR pszString, BOOL bIgnoreColon);
};

#endif //__ENUMSER_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -