From: newton-cn Date: Sat, 3 May 2025 06:57:09 +0000 (+0900) Subject: 마우스이벤트 X-Git-Url: https://git.insang.kr/gitweb/?a=commitdiff_plain;h=b677cae99d02dbee724baf8e549b94dd332301bd;p=wevape-lu1_pos.git 마우스이벤트 --- diff --git a/.vs/newton-cn/v16/.suo b/.vs/newton-cn/v16/.suo index 41ba35c..54e1731 100644 Binary files a/.vs/newton-cn/v16/.suo and b/.vs/newton-cn/v16/.suo differ diff --git a/newton-cn/Form1.cs b/newton-cn/Form1.cs index 939978b..3bbfe7a 100644 --- a/newton-cn/Form1.cs +++ b/newton-cn/Form1.cs @@ -28,6 +28,9 @@ namespace newton_cn { this.ShowInTaskbar = false; InitializeComponent(); + USBControl.DisableDevice("cn"); + System.Threading.Thread.Sleep(5000); + USBControl.EnableDevice("cn"); } private void Form1_Load(object sender, EventArgs e) { diff --git a/newton-cn/Properties/app.manifest b/newton-cn/Properties/app.manifest new file mode 100644 index 0000000..c961c3b --- /dev/null +++ b/newton-cn/Properties/app.manifest @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/USBControl.cs b/newton-cn/USBControl.cs index b06c540..d218278 100644 --- a/newton-cn/USBControl.cs +++ b/newton-cn/USBControl.cs @@ -5,30 +5,27 @@ using System.Management; class USBControl { + // 뉴턴 청라점 VID_1A2C&PID_0042 + public static string getDeviceId(string where) + { + return where == "cn" ? "VID_1A2C&PID_0042" : ""; + } public static void test() + { + } + + // 장치 비활성화 + public static void DisableDevice(string where) { - Console.WriteLine("현재 연결된 USB 장치 목록:"); - Console.WriteLine("-----------------------------------"); - string result = ""; + string deviceId = getDeviceId(where); try { - // Win32_PnPEntity 클래스에서 USB 관련 장치 검색 - string query = "SELECT * FROM Win32_PnPEntity WHERE DeviceID LIKE '%046D%' and Name= 'HID 규격 마우스'"; - using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(query)) + string query = $"SELECT * FROM Win32_PnPEntity WHERE DeviceID like '%{deviceId}%'"; + ManagementObjectSearcher searcher = new ManagementObjectSearcher(query); + foreach (ManagementObject device in searcher.Get()) { - foreach (ManagementObject device in searcher.Get()) - { - Console.WriteLine($"이름: {device["Name"]}"); - Console.WriteLine($"장치 ID: {device["DeviceID"]}"); - Console.WriteLine($"설명: {device["Description"]}"); - Console.WriteLine("-----------------------------------"); - - ManagementBaseObject disabled = device.InvokeMethod("Disable", null, null); - - System.Threading.Thread.Sleep(5000); - - ManagementBaseObject enabled = device.InvokeMethod("Enable", null, null); - } + ManagementBaseObject outParams = device.InvokeMethod("Disable", null, null); + Console.WriteLine($"장치 {deviceId}가 비활성화되었습니다."); } } catch (Exception ex) @@ -37,27 +34,24 @@ class USBControl } } - // 장치 비활성화 - public static void DisableDevice(string deviceId) + // 장치 활성화 + public static void EnableDevice(string where) { - string query = $"SELECT * FROM Win32_PnPEntity WHERE DeviceID = '{deviceId}'"; - ManagementObjectSearcher searcher = new ManagementObjectSearcher(query); - foreach (ManagementObject device in searcher.Get()) + string deviceId = getDeviceId(where); + try { - ManagementBaseObject outParams = device.InvokeMethod("Disable", null, null); - Console.WriteLine($"장치 {deviceId}가 비활성화되었습니다."); + string query = $"SELECT * FROM Win32_PnPEntity WHERE DeviceID like '%{deviceId}%'"; + ManagementObjectSearcher searcher = new ManagementObjectSearcher(query); + foreach (ManagementObject device in searcher.Get()) + { + ManagementBaseObject outParams = device.InvokeMethod("Enable", null, null); + Console.WriteLine($"장치 {deviceId}가 활성화되었습니다."); + } } - } - - // 장치 활성화 - public static void EnableDevice(string deviceId) - { - string query = $"SELECT * FROM Win32_PnPEntity WHERE DeviceID = '{deviceId}'"; - ManagementObjectSearcher searcher = new ManagementObjectSearcher(query); - foreach (ManagementObject device in searcher.Get()) + catch (Exception ex) { - ManagementBaseObject outParams = device.InvokeMethod("Enable", null, null); - Console.WriteLine($"장치 {deviceId}가 활성화되었습니다."); + Console.WriteLine($"USB 장치 정보를 가져오는 중 오류 발생: {ex.Message}"); } + } } \ No newline at end of file diff --git a/newton-cn/bin/Debug/app.publish/newton-cn.exe b/newton-cn/bin/Debug/app.publish/newton-cn.exe new file mode 100644 index 0000000..b0f7318 Binary files /dev/null and b/newton-cn/bin/Debug/app.publish/newton-cn.exe differ diff --git a/newton-cn/bin/Debug/newton-cn.application b/newton-cn/bin/Debug/newton-cn.application new file mode 100644 index 0000000..7672178 --- /dev/null +++ b/newton-cn/bin/Debug/newton-cn.application @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + zQdWY35FU7zFNn56WfgqMN5Nk1w= + + + + \ No newline at end of file diff --git a/newton-cn/bin/Debug/newton-cn.exe b/newton-cn/bin/Debug/newton-cn.exe index 17e3537..b0f7318 100644 Binary files a/newton-cn/bin/Debug/newton-cn.exe and b/newton-cn/bin/Debug/newton-cn.exe differ diff --git a/newton-cn/bin/Debug/newton-cn.exe.manifest b/newton-cn/bin/Debug/newton-cn.exe.manifest new file mode 100644 index 0000000..5ffcb36 --- /dev/null +++ b/newton-cn/bin/Debug/newton-cn.exe.manifest @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1pf4byyQjJGqwPrIsMoYcuOQGWs= + + + + + + + + + + 60+p9NXC1fxypc5g3dMH4EOGocU= + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/Debug/newton-cn.pdb b/newton-cn/bin/Debug/newton-cn.pdb index 1c38bf7..5191bfa 100644 Binary files a/newton-cn/bin/Debug/newton-cn.pdb and b/newton-cn/bin/Debug/newton-cn.pdb differ diff --git a/newton-cn/bin/Release/app.publish/newton-cn.exe b/newton-cn/bin/Release/app.publish/newton-cn.exe new file mode 100644 index 0000000..f54969f Binary files /dev/null and b/newton-cn/bin/Release/app.publish/newton-cn.exe differ diff --git a/newton-cn/bin/Release/newton-cn.application b/newton-cn/bin/Release/newton-cn.application new file mode 100644 index 0000000..8afdd98 --- /dev/null +++ b/newton-cn/bin/Release/newton-cn.application @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + HrLMr34zLqfb+9gjo3VDbvYxqFg= + + + + \ No newline at end of file diff --git a/newton-cn/bin/Release/newton-cn.exe b/newton-cn/bin/Release/newton-cn.exe index a098464..f54969f 100644 Binary files a/newton-cn/bin/Release/newton-cn.exe and b/newton-cn/bin/Release/newton-cn.exe differ diff --git a/newton-cn/bin/Release/newton-cn.exe.manifest b/newton-cn/bin/Release/newton-cn.exe.manifest new file mode 100644 index 0000000..2709a9d --- /dev/null +++ b/newton-cn/bin/Release/newton-cn.exe.manifest @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + qn/l/t0WM+zVri9sXOfDi90x8cg= + + + + + + + + + + 60+p9NXC1fxypc5g3dMH4EOGocU= + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/Release/newton-cn.pdb b/newton-cn/bin/Release/newton-cn.pdb index 6c84e5b..9a70e05 100644 Binary files a/newton-cn/bin/Release/newton-cn.pdb and b/newton-cn/bin/Release/newton-cn.pdb differ diff --git a/newton-cn/newton-cn.csproj b/newton-cn/newton-cn.csproj index dd3b963..4d80f35 100644 --- a/newton-cn/newton-cn.csproj +++ b/newton-cn/newton-cn.csproj @@ -48,6 +48,15 @@ prompt 4 + + LocalIntranet + + + true + + + Properties\app.manifest + @@ -138,6 +147,7 @@ Resources.resx True + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/newton-cn/newton-cn.csproj.user b/newton-cn/newton-cn.csproj.user index f68fc3d..c049d6b 100644 --- a/newton-cn/newton-cn.csproj.user +++ b/newton-cn/newton-cn.csproj.user @@ -10,4 +10,7 @@ ko-KR false + + false + \ No newline at end of file diff --git a/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache index 8f7c0b2..c869464 100644 Binary files a/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 6e6e6e5..b427b6c 100644 Binary files a/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/newton-cn/obj/Debug/newton-cn.TrustInfo.xml b/newton-cn/obj/Debug/newton-cn.TrustInfo.xml new file mode 100644 index 0000000..9883d40 --- /dev/null +++ b/newton-cn/obj/Debug/newton-cn.TrustInfo.xml @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/newton-cn/obj/Debug/newton-cn.application b/newton-cn/obj/Debug/newton-cn.application new file mode 100644 index 0000000..7672178 --- /dev/null +++ b/newton-cn/obj/Debug/newton-cn.application @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + zQdWY35FU7zFNn56WfgqMN5Nk1w= + + + + \ No newline at end of file diff --git a/newton-cn/obj/Debug/newton-cn.csproj.FileListAbsolute.txt b/newton-cn/obj/Debug/newton-cn.csproj.FileListAbsolute.txt index 2684ab1..601163f 100644 --- a/newton-cn/obj/Debug/newton-cn.csproj.FileListAbsolute.txt +++ b/newton-cn/obj/Debug/newton-cn.csproj.FileListAbsolute.txt @@ -35,3 +35,8 @@ z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Debug\newton-cn.pd z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Debug\newton_cn.Form5.resources z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Debug\newton-cn.csproj.AssemblyReference.cache z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Debug\newton_cn.Form6.resources +z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\bin\Debug\newton-cn.exe.manifest +z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\bin\Debug\newton-cn.application +z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Debug\newton-cn.TrustInfo.xml +z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Debug\newton-cn.exe.manifest +z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Debug\newton-cn.application diff --git a/newton-cn/obj/Debug/newton-cn.exe b/newton-cn/obj/Debug/newton-cn.exe index 17e3537..b0f7318 100644 Binary files a/newton-cn/obj/Debug/newton-cn.exe and b/newton-cn/obj/Debug/newton-cn.exe differ diff --git a/newton-cn/obj/Debug/newton-cn.exe.manifest b/newton-cn/obj/Debug/newton-cn.exe.manifest new file mode 100644 index 0000000..5ffcb36 --- /dev/null +++ b/newton-cn/obj/Debug/newton-cn.exe.manifest @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1pf4byyQjJGqwPrIsMoYcuOQGWs= + + + + + + + + + + 60+p9NXC1fxypc5g3dMH4EOGocU= + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/obj/Debug/newton-cn.pdb b/newton-cn/obj/Debug/newton-cn.pdb index 1c38bf7..5191bfa 100644 Binary files a/newton-cn/obj/Debug/newton-cn.pdb and b/newton-cn/obj/Debug/newton-cn.pdb differ diff --git a/newton-cn/obj/Release/newton-cn.TrustInfo.xml b/newton-cn/obj/Release/newton-cn.TrustInfo.xml new file mode 100644 index 0000000..9883d40 --- /dev/null +++ b/newton-cn/obj/Release/newton-cn.TrustInfo.xml @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/newton-cn/obj/Release/newton-cn.application b/newton-cn/obj/Release/newton-cn.application new file mode 100644 index 0000000..8afdd98 --- /dev/null +++ b/newton-cn/obj/Release/newton-cn.application @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + HrLMr34zLqfb+9gjo3VDbvYxqFg= + + + + \ No newline at end of file diff --git a/newton-cn/obj/Release/newton-cn.csproj.FileListAbsolute.txt b/newton-cn/obj/Release/newton-cn.csproj.FileListAbsolute.txt index f9abb88..69aca02 100644 --- a/newton-cn/obj/Release/newton-cn.csproj.FileListAbsolute.txt +++ b/newton-cn/obj/Release/newton-cn.csproj.FileListAbsolute.txt @@ -34,3 +34,8 @@ z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Release\newton_cn. z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Release\newton_cn.Form4.resources z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Release\newton_cn.Form5.resources z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Release\newton_cn.Form6.resources +z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\bin\Release\newton-cn.exe.manifest +z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\bin\Release\newton-cn.application +z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Release\newton-cn.TrustInfo.xml +z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Release\newton-cn.exe.manifest +z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Release\newton-cn.application diff --git a/newton-cn/obj/Release/newton-cn.exe b/newton-cn/obj/Release/newton-cn.exe index a098464..f54969f 100644 Binary files a/newton-cn/obj/Release/newton-cn.exe and b/newton-cn/obj/Release/newton-cn.exe differ diff --git a/newton-cn/obj/Release/newton-cn.exe.manifest b/newton-cn/obj/Release/newton-cn.exe.manifest new file mode 100644 index 0000000..2709a9d --- /dev/null +++ b/newton-cn/obj/Release/newton-cn.exe.manifest @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + qn/l/t0WM+zVri9sXOfDi90x8cg= + + + + + + + + + + 60+p9NXC1fxypc5g3dMH4EOGocU= + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/obj/Release/newton-cn.pdb b/newton-cn/obj/Release/newton-cn.pdb index 6c84e5b..9a70e05 100644 Binary files a/newton-cn/obj/Release/newton-cn.pdb and b/newton-cn/obj/Release/newton-cn.pdb differ