OSDN Git Service

DirectInputのポーリング時、バックグラウンドに移るなどの要因で OtherApplicationHasPriority エラー「以外」が発生した場合にのみデバイ...
[dtxmania/dtxmania.git] / FDK17プロジェクト / コード / 02.入力 / CInput管理.cs
index 28de3f3..fd2082f 100644 (file)
@@ -183,16 +183,19 @@ namespace FDK
                                        {\r
                                                device.tポーリング(bWindowがアクティブ中, bバッファ入力を使用する);\r
                                        }\r
-                                       catch (Exception e)                                                                             // #24016 2011.1.6 yyagi: catch exception for unplugging USB joystick, and remove the device object from the polling items.\r
+                                       catch (SharpDX.SharpDXException e)                                                                              // #24016 2011.1.6 yyagi: catch exception for unplugging USB joystick, and remove the device object from the polling items.\r
                                        {\r
-                                               Trace.TraceError("tポーリング(): " + device.e入力デバイス種別.ToString() + " : " + e.Message);\r
-                                               if (device.e入力デバイス種別 == E入力デバイス種別.Joystick)\r
+                                               if( e.ResultCode == ResultCode.OtherApplicationHasPriority )\r
                                                {\r
-                                                       this.list入力デバイス.Remove(device);\r
+                                                       // #xxxxx: 2017.5.9: from: このエラーの時は、何もしない。\r
+                                               }\r
+                                               else\r
+                                               {\r
+                                                       // #xxxxx: 2017.5.9: from: その他のエラーの場合は、デバイスが外されたと想定してRemoveする。\r
+                                                       this.list入力デバイス.Remove( device );\r
                                                        device.Dispose();\r
-                                                       Trace.TraceError("tポーリング時に対象deviceが抜かれており例外発生。同deviceをポーリング対象からRemoveしました。");\r
+                                                       Trace.TraceError( "tポーリング時に対象deviceが抜かれており例外発生。同deviceをポーリング対象からRemoveしました。" );\r
                                                }\r
-                                               // Keyboard, mouseは、外されても、何もしない\r
                                        }\r
                                }\r
                        }\r