반환 된 기기 정보 세트의 문제를 어떻게 알 수 있습니까? 나는 다시 코드를 작성하고 있는데, 여전히 같은 걸림돌을 치고있다.C#에서 SetupDiGetClassDev 인터페이스의 문제점을 어떻게 알 수 있습니까?
deviceInfoSet = SetupDiGetClassDevs(ref tGuid, 0, IntPtr.Zero, (uint)SetupDiFlags.DIGCF_PRESENT);
if (deviceInfoSet.ToInt32() == INVALID_DEVICE_HANDLE)
{
int errCode = Marshal.GetLastWin32Error();
errorMessage = new Win32Exception(Marshal.GetLastWin32Error()).Message;
statusLabel.Text += "Invalid deviceinfoset returned: " + errCode + " => " + errorMessage + ".";
}
위의 코드는 오류가 발생하지 않습니다하지만 아래의 코드를 사용하는 경우 :
result = true;
while (result)
{
result = SetupDiEnumDeviceInterfaces(deviceInfoSet, IntPtr.Zero, ref tGuid, Index, ref anInterface);
if (!result)
{
int errCode = Marshal.GetLastWin32Error();
errorMessage = new Win32Exception(Marshal.GetLastWin32Error()).Message;
statusLabel.Text += "\nSetDiEnumDeviceInterface Error: " + errCode + " => " + errorMessage + ".";
break;
}
Index++;
}
259 (더 이상 데이터가 시도하고 장치 정보 설정 목록, 에러 코드에 액세스 할 수 available)가 반환됩니다. 나는 내가 뭘 잘못하고 있는지를 놓치고있다.
-1 http://pixcl.com/SetupDiEnumInterfaces_Fail.htm를 참조 몸에 문장을 계속. –
나는 정말로 당신의 질문 제목을 업데이트 할 것입니다; 그것은 매우 모호합니다. 아마도 "USB device programming : Invalid deviceinfo set."과 같은 말을 할 수 있습니다. –
P 아빠와 양 시뮬레이터는 유감 스럽지만 2 일 동안 동일한 서클에서 돌아가고있어 무엇이 잘못되었는지 알아 내려고 스트레스를받습니다. 나는 다음에 더 설명하기 쉽도록 할 것입니다. –