基本信息
源码名称:c# 获取usb pid,vid方法
源码大小:47.71M
文件格式:.rar
开发语言:C#
更新时间:2022-01-10
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍

通过c 获取。编译成动态库,供c#调用。

 try
            {
                // 开辟一块控件
                string strout = new string('\0', 1000);
                // 调用C 库,返回字符串。
                string str = Marshal.PtrToStringAnsi(GetUsbInfo(Encoding.ASCII.GetBytes(strout)));              
                // 打印字符串
                PrintStr(str);
                Console.Read();
            }
            catch (Exception ex) 
            {
                Console.WriteLine(ex.ToString());
            }

        }

        static void PrintStr(string origin) 
        {
            List<string> pidList = origin.Split('#').Where(s => s.Contains("pid")).ToList();
            foreach (string temp in pidList) 
            {
                Console.WriteLine(temp);     
            }
        }

.
├── 获取USB串口Vid
│   ├── GetPid
│   │   ├── GetPid.cpp
│   │   ├── GetPid.sln
│   │   ├── GetPid.vcxproj
│   │   ├── GetPid.vcxproj.filters
│   │   ├── GetPid.vcxproj.user
│   │   └── Release
│   │       ├── GetPid.Build.CppClean.log
│   │       ├── GetPid.dll
│   │       ├── GetPid.dll.recipe
│   │       ├── GetPid.exp
│   │       ├── GetPid.iobj
│   │       ├── GetPid.ipdb
│   │       ├── GetPid.lib
│   │       ├── GetPid.log
│   │       ├── GetPid.obj
│   │       ├── GetPid.pdb
│   │       ├── GetPid.tlog
│   │       │   ├── CL.command.1.tlog
│   │       │   ├── CL.read.1.tlog
│   │       │   ├── CL.write.1.tlog
│   │       │   ├── GetPid.lastbuildstate
│   │       │   ├── GetPid.write.1u.tlog
│   │       │   ├── link.command.1.tlog
│   │       │   ├── link.read.1.tlog
│   │       │   └── link.write.1.tlog
│   │       ├── GetPid.vcxproj.FileListAbsolute.txt
│   │       └── vc142.pdb
│   └── c#调用
│       ├── App.config
│       ├── ConsoleApp1.csproj
│       ├── Program.cs
│       ├── Properties
│       │   └── AssemblyInfo.cs
│       ├── bin
│       │   ├── Debug
│       │   │   ├── ConsoleApp1.exe
│       │   │   ├── ConsoleApp1.exe.config
│       │   │   ├── ConsoleApp1.pdb
│       │   │   ├── GetPid.dll
│       │   │   ├── GetPid.exp
│       │   │   ├── GetPid.ilk
│       │   │   ├── GetPid.lib
│       │   │   └── GetPid.pdb
│       │   └── Release
│       └── obj
│           └── Debug
│               ├── ConsoleApp1.csproj.CoreCompileInputs.cache
│               ├── ConsoleApp1.csproj.FileListAbsolute.txt
│               ├── ConsoleApp1.csprojAssemblyReference.cache
│               ├── ConsoleApp1.exe
│               ├── ConsoleApp1.pdb
│               ├── DesignTimeResolveAssemblyReferencesInput.cache
│               └── TempPE
└── 好例子网_获取USB串口Vid (1).rar

12 directories, 44 files