• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Notifying a message in Action center.


Commit MetaInfo

Revisão4e0cef5a53eb07356dfc0c83047cc7a121ddcbb7 (tree)
Hora2015-09-11 12:48:47
AutorJeffyTS <JeffyTS@outl...>
CommiterJeffyTS

Mensagem de Log

Enabled GO NoGUI but diplaying an error message and going on running.

Mudança Sumário

Diff

--- a/CtrlVIX/CtrlVix.cs
+++ b/CtrlVIX/CtrlVix.cs
@@ -161,6 +161,12 @@ namespace CtrlVix
161161 {
162162 // NOP
163163 }
164+ // for Player 12.0.0 NOGUI させたとき VIX_E_CANCELLEDはメッセージは表示するがエラーとはしない
165+ else if ((powerOP == Constants.POWEROP.POWER_ON_NOGUI) &&
166+ (IVixLib.ErrorCode(err) == VixCOM.Constants.VIX_E_CANCELLED))
167+ {
168+ ErrMessage(err);
169+ }
164170 else
165171 {
166172 // Error Handler
@@ -727,6 +733,109 @@ namespace CtrlVix
727733 #endif
728734 switch (err)
729735 {
736+#if !DEBUG
737+ case VixCOM.Constants.VIX_E_FAIL: // 1
738+ errMsg = "VIX_E_FAIL";
739+ break;
740+ case VixCOM.Constants.VIX_E_OUT_OF_MEMORY: // 2
741+ errMsg = "VIX_E_OUT_OF_MEMORY";
742+ break;
743+ case VixCOM.Constants.VIX_E_INVALID_ARG: // 3
744+ errMsg = "VIX_E_INVALID_ARG";
745+ break;
746+ case VixCOM.Constants.VIX_E_FILE_NOT_FOUND: // 4
747+ errMsg = "VIX_E_FILE_NOT_FOUND";
748+ break;
749+ case VixCOM.Constants.VIX_E_OBJECT_IS_BUSY: // 5
750+ errMsg = "VIX_E_OBJECT_IS_BUSY";
751+ break;
752+ case VixCOM.Constants.VIX_E_NOT_SUPPORTED: // 6
753+ errMsg = "VIX_E_NOT_SUPPORTED";
754+ break;
755+ case VixCOM.Constants.VIX_E_FILE_ERROR: // 7
756+ errMsg = "VIX_E_FILE_ERROR";
757+ break;
758+ case VixCOM.Constants.VIX_E_DISK_FULL: // 8
759+ errMsg = "VIX_E_DISK_FULL";
760+ break;
761+ case VixCOM.Constants.VIX_E_INCORRECT_FILE_TYPE: // 9
762+ errMsg = "VIX_E_INCORRECT_FILE_TYPE";
763+ break;
764+#endif
765+ case VixCOM.Constants.VIX_E_CANCELLED: // 10
766+ errMsg = "Operation cancelled.";
767+ break;
768+#if !DEBUG
769+ case VixCOM.Constants.VIX_E_FILE_READ_ONLY: // 11
770+ errMsg = "VIX_E_FILE_READ_ONLY";
771+ break;
772+ case VixCOM.Constants.VIX_E_FILE_ALREADY_EXISTS: // 12
773+ errMsg = "VIX_E_FILE_ALREADY_EXISTS";
774+ break;
775+ case VixCOM.Constants.VIX_E_FILE_ACCESS_ERROR: // 13
776+ errMsg = "VIX_E_FILE_ACCESS_ERROR";
777+ break;
778+ case VixCOM.Constants.VIX_E_REQUIRES_LARGE_FILES: // 14
779+ errMsg = "VIX_E_REQUIRES_LARGE_FILES";
780+ break;
781+ case VixCOM.Constants.VIX_E_FILE_ALREADY_LOCKED: // 15
782+ errMsg = "VIX_E_FILE_ALREADY_LOCKED";
783+ break;
784+ case VixCOM.Constants.VIX_E_VMDB: // 16
785+ errMsg = "VIX_E_VMDB";
786+ break;
787+ case VixCOM.Constants.VIX_E_NOT_SUPPORTED_ON_REMOTE_OBJECT: // 20
788+ errMsg = "VIX_E_NOT_SUPPORTED_ON_REMOTE_OBJECT";
789+ break;
790+ case VixCOM.Constants.VIX_E_FILE_TOO_BIG: // 21
791+ errMsg = "VIX_E_FILE_TOO_BIG";
792+ break;
793+ case VixCOM.Constants.VIX_E_FILE_NAME_INVALID: // 22
794+ errMsg = "VIX_E_FILE_NAME_INVALID";
795+ break;
796+ case VixCOM.Constants.VIX_E_ALREADY_EXISTS: // 23
797+ errMsg = "VIX_E_ALREADY_EXISTS";
798+ break;
799+ case VixCOM.Constants.VIX_E_BUFFER_TOOSMALL: // 24
800+ errMsg = "VIX_E_BUFFER_TOOSMALL";
801+ break;
802+ case VixCOM.Constants.VIX_E_OBJECT_NOT_FOUND: // 25
803+ errMsg = "VIX_E_OBJECT_NOT_FOUND";
804+ break;
805+ case VixCOM.Constants.VIX_E_HOST_NOT_CONNECTED: // 26
806+ errMsg = "VIX_E_HOST_NOT_CONNECTED";
807+ break;
808+ case VixCOM.Constants.VIX_E_INVALID_UTF8_STRING: // 27
809+ errMsg = "VIX_E_INVALID_UTF8_STRING";
810+ break;
811+ case VixCOM.Constants.VIX_E_OPERATION_ALREADY_IN_PROGRESS: // 31
812+ errMsg = "VIX_E_OPERATION_ALREADY_IN_PROGRESS";
813+ break;
814+ case VixCOM.Constants.VIX_E_UNFINISHED_JOB: // 29
815+ errMsg = "VIX_E_UNFINISHED_JOB";
816+ break;
817+ case VixCOM.Constants.VIX_E_NEED_KEY: // 30
818+ errMsg = "VIX_E_NEED_KEY";
819+ break;
820+ case VixCOM.Constants.VIX_E_LICENSE: // 32
821+ errMsg = "VIX_E_LICENSE";
822+ break;
823+ case VixCOM.Constants.VIX_E_VM_HOST_DISCONNECTED: // 34
824+ errMsg = "VIX_E_VM_HOST_DISCONNECTED";
825+ break;
826+ case VixCOM.Constants.VIX_E_AUTHENTICATION_FAIL: // 35
827+ errMsg = "VIX_E_AUTHENTICATION_FAIL";
828+ break;
829+ case VixCOM.Constants.VIX_E_HOST_CONNECTION_LOST: // 36
830+ errMsg = "VIX_E_HOST_CONNECTION_LOST";
831+ break;
832+ case VixCOM.Constants.VIX_E_DUPLICATE_NAME: // 41
833+ errMsg = "ConVIX_E_DUPLICATE_NAME";
834+ break;
835+ case VixCOM.Constants.VIX_E_ARGUMENT_TOO_BIG: // 44
836+ errMsg = "VIX_E_ARGUMENT_TOO_BIG";
837+ break;
838+#endif
730839 case VixCOM.Constants.VIX_E_TIMEOUT_WAITING_FOR_TOOLS: // 3000
731840 errMsg = "Power operation has not been able to be completed.";
732841 break;
--- a/VMwPlayerTaskTray/MainForm.cs
+++ b/VMwPlayerTaskTray/MainForm.cs
@@ -27,8 +27,7 @@ namespace VMwPlayerTaskTray
2727 " " + PROGRAM_NAME + ".exe [opt] \"FullPath.vmx\"\r\n" +
2828 "\r\n" +
2929 " Option:\r\n" +
30- // for Player 12 " /gui | /nogui | (none)";
31- " /gui | (none)\r\n" +
30+ " /gui | /nogui | (none)\r\n" +
3231 " /pos num_left num_top";
3332 private const string MSG_RUN_DUP = PROGRAM_NAME + " has been already running with \r\n" +
3433 "same guest OS.\r\n" +
@@ -78,12 +77,10 @@ namespace VMwPlayerTaskTray
7877 {
7978 VMControl(VMCTRL.GO_GUI);
8079 }
81- /**** for Player 12
8280 else if (Program.startMode == "/nogui")
8381 {
8482 VMControl(VMCTRL.GO_NOGUI);
8583 }
86- ****/
8784 else
8885 {
8986 this.timer_MainForm.Enabled = true; // Timerを有効にする
@@ -101,7 +98,7 @@ namespace VMwPlayerTaskTray
10198 {
10299 this.timer_MainForm.Enabled = false; // Timerを無効にする
103100 #if DEBUG
104- Debug.WriteLine("Timer Thread : Start");
101+ //Debug.WriteLine("Timer Thread : Start");
105102 #endif
106103 ChangeMenuItem(vmxFilePath); // VMwareの動作状態をチェックしMenuItemの表示を切り替える
107104 if (vmState == VMSTATE.ERROR)
@@ -111,7 +108,7 @@ namespace VMwPlayerTaskTray
111108 Application.Exit(); // アプリケーション終了
112109 }
113110 #if DEBUG
114- Debug.WriteLine("Timer Thread : Finish");
111+ //Debug.WriteLine("Timer Thread : Finish");
115112 #endif
116113 this.timer_MainForm.Enabled = true; // Timerを有効にする
117114 }
--- a/VMwPlayerTaskTray/MainFormSub.cs
+++ b/VMwPlayerTaskTray/MainFormSub.cs
@@ -27,8 +27,7 @@ namespace VMwPlayerTaskTray
2727 " " + PROGRAM_NAME + ".exe [opt] \"FullPath.vmx\"\r\n" +
2828 "\r\n" +
2929 " Option:\r\n" +
30- // for Player 12 " /gui | /nogui | (none)";
31- " /gui | (none)\r\n" +
30+ " /gui | /nogui | (none)\r\n" +
3231 " /pos left top | (none)";
3332 private const string MSG_VIX_ERR = "A fatal error has occured inside VIX.\r\n" +
3433 "Exiting " + PROGRAM_NAME + "...";
@@ -173,10 +172,14 @@ namespace VMwPlayerTaskTray
173172 {
174173 case VMCTRL.GO_GUI:
175174 case VMCTRL.GO_NOGUI:
176- while ((state = Vix.GetVMState(vmxFilePath)) != CtrlVix.Constants.VMSTATE.POWERED_ON)
175+ for(int i = 0; i < 10; i++)
177176 {
178- if (state == CtrlVix.Constants.VMSTATE.ERROR) return false;
179- System.Threading.Thread.Sleep(3000);
177+ if ((state = Vix.GetVMState(vmxFilePath)) != CtrlVix.Constants.VMSTATE.POWERED_ON)
178+ {
179+ if (state == CtrlVix.Constants.VMSTATE.ERROR) return false;
180+ System.Threading.Thread.Sleep(3000);
181+ }
182+ else break;
180183 }
181184 if (mode == VMCTRL.GO_GUI && Program.moveWindow == true) // GO_GUIの時だけPlayer Windowを移動する
182185 {
@@ -193,13 +196,17 @@ namespace VMwPlayerTaskTray
193196 System.Threading.Thread.Sleep(3000);
194197 break;
195198 case VMCTRL.GO_SUSPEND:
196- while (((state = Vix.GetVMState(vmxFilePath)) != CtrlVix.Constants.VMSTATE.POWERED_OFF)
199+ for (int i = 0; i < 10; i++)
200+ {
201+ if (((state = Vix.GetVMState(vmxFilePath)) != CtrlVix.Constants.VMSTATE.POWERED_OFF)
197202 && ((pwOff = Vix.CheckPowerOffMode(vmxFilePath))
198203 != CtrlVix.Constants.POWER_OFF_MODE.SUSPENDED))
199- {
200- if (state == CtrlVix.Constants.VMSTATE.ERROR) return false;
201- if (pwOff == CtrlVix.Constants.POWER_OFF_MODE.ERROR) return false;
202- System.Threading.Thread.Sleep(3000);
204+ {
205+ if (state == CtrlVix.Constants.VMSTATE.ERROR) return false;
206+ if (pwOff == CtrlVix.Constants.POWER_OFF_MODE.ERROR) return false;
207+ System.Threading.Thread.Sleep(3000);
208+ }
209+ else break;
203210 }
204211 break;
205212 case VMCTRL.GO_ACPI_POWER_OFF:
@@ -339,12 +346,11 @@ namespace VMwPlayerTaskTray
339346
340347 aboutToolStripMenuItem.Enabled = true; // Aboutは常に表示
341348 exitToolStripMenuItem.Enabled = true; // Exitは常に表示
342- ToolStripMenuItem_GoNoGUI.Enabled = false; // GoNoGUIは常に表示しない for Player 12.0
343349 switch (mode)
344350 {
345351 case MENU_MODE.RUNNING_GUI:
346352 ToolStripMenuItem_GoGUI.Enabled = false;
347- // for Player 12.0 ToolStripMenuItem_GoNoGUI.Enabled = true;
353+ ToolStripMenuItem_GoNoGUI.Enabled = true;
348354 ToolStripMenuItem_GoSuspend.Enabled = true;
349355 ToolStripMenuItem_OtherCommand.Enabled = true;
350356 this.notifyIcon_MainForm.Text = "Running as GUI - " + vmxName;
@@ -353,7 +359,7 @@ namespace VMwPlayerTaskTray
353359 break;
354360 case MENU_MODE.RUNNING_NOGUI:
355361 ToolStripMenuItem_GoGUI.Enabled = true;
356- // for Player 12.0 ToolStripMenuItem_GoNoGUI.Enabled = false;
362+ ToolStripMenuItem_GoNoGUI.Enabled = false;
357363 ToolStripMenuItem_GoSuspend.Enabled = true;
358364 ToolStripMenuItem_OtherCommand.Enabled = true;
359365 this.notifyIcon_MainForm.Text = "Running as NoGUI - " + vmxName;
@@ -362,7 +368,7 @@ namespace VMwPlayerTaskTray
362368 break;
363369 case MENU_MODE.PROCESSING:
364370 ToolStripMenuItem_GoGUI.Enabled = false;
365- // for Player 12.0 ToolStripMenuItem_GoNoGUI.Enabled = false;
371+ ToolStripMenuItem_GoNoGUI.Enabled = false;
366372 ToolStripMenuItem_GoSuspend.Enabled = false;
367373 ToolStripMenuItem_OtherCommand.Enabled = false;
368374 this.notifyIcon_MainForm.Text = "Processing - " + vmxName;
@@ -371,7 +377,7 @@ namespace VMwPlayerTaskTray
371377 break;
372378 case MENU_MODE.SUSPENDED:
373379 ToolStripMenuItem_GoGUI.Enabled = true;
374- // for Player 12.0 ToolStripMenuItem_GoNoGUI.Enabled = true;
380+ ToolStripMenuItem_GoNoGUI.Enabled = true;
375381 ToolStripMenuItem_GoSuspend.Enabled = false;
376382 ToolStripMenuItem_OtherCommand.Enabled = false;
377383 this.notifyIcon_MainForm.Text = "Suspended - " + vmxName;
@@ -380,7 +386,7 @@ namespace VMwPlayerTaskTray
380386 break;
381387 case MENU_MODE.POWERED_OFF:
382388 ToolStripMenuItem_GoGUI.Enabled = true;
383- // for Player 12.0 ToolStripMenuItem_GoNoGUI.Enabled = true;
389+ ToolStripMenuItem_GoNoGUI.Enabled = true;
384390 ToolStripMenuItem_GoSuspend.Enabled = false;
385391 ToolStripMenuItem_OtherCommand.Enabled = false;
386392 this.notifyIcon_MainForm.Text = "Powered OFF - " + vmxName;
@@ -389,7 +395,7 @@ namespace VMwPlayerTaskTray
389395 break;
390396 case MENU_MODE.CANNOT_DEFINE_RUNNING_MODE:
391397 ToolStripMenuItem_GoGUI.Enabled = false;
392- // for Player 12.0 ToolStripMenuItem_GoNoGUI.Enabled = false;
398+ ToolStripMenuItem_GoNoGUI.Enabled = false;
393399 ToolStripMenuItem_GoSuspend.Enabled = true;
394400 ToolStripMenuItem_OtherCommand.Enabled = true;
395401 this.notifyIcon_MainForm.Text = "Running as ether GUI/NoGUI - " + vmxName;
@@ -399,7 +405,7 @@ namespace VMwPlayerTaskTray
399405 break;
400406 case MENU_MODE.NO_VMXFILE:
401407 ToolStripMenuItem_GoGUI.Enabled = false;
402- // for Player 12.0 ToolStripMenuItem_GoNoGUI.Enabled = false;
408+ ToolStripMenuItem_GoNoGUI.Enabled = false;
403409 ToolStripMenuItem_GoSuspend.Enabled = false;
404410 ToolStripMenuItem_OtherCommand.Enabled = false;
405411 this.notifyIcon_MainForm.Text = "Can't find vmx file - " + vmxName;
@@ -410,7 +416,7 @@ namespace VMwPlayerTaskTray
410416 case MENU_MODE.ERROR:
411417 default:
412418 ToolStripMenuItem_GoGUI.Enabled = false;
413- // for Player 12.0 ToolStripMenuItem_GoNoGUI.Enabled = false;
419+ ToolStripMenuItem_GoNoGUI.Enabled = false;
414420 ToolStripMenuItem_GoSuspend.Enabled = false;
415421 ToolStripMenuItem_OtherCommand.Enabled = false;
416422 this.notifyIcon_MainForm.Text = "Error - " + vmxName;
@@ -505,7 +511,7 @@ namespace VMwPlayerTaskTray
505511
506512 if (pid != 0)
507513 {
508- if (move_window(pid, left, top)) // Windowを移動する
514+ if (move_window(pid, left, top, "VMPlayerFrame")) // Windowを移動する
509515 {
510516 return true;
511517 }
@@ -535,7 +541,7 @@ namespace VMwPlayerTaskTray
535541 [System.Runtime.InteropServices.DllImport("user32.dll")] private extern static IntPtr FindWindowEx(IntPtr hWndParent, IntPtr hWndChildAfter, String lpszClass, String lpszWindow);
536542
537543 // 指定したPIDのWindowを移動させる
538- private bool move_window(int pid, int left, int top)
544+ private bool move_window(int pid, int left, int top, string classname)
539545 {
540546 RECT rect = new RECT();
541547 rect.Left = 0; rect.Top = 0; rect.Right = 0; rect.Bottom = 0;
@@ -543,7 +549,7 @@ namespace VMwPlayerTaskTray
543549 IntPtr hWnd = IntPtr.Zero;
544550 IntPtr hWndChildAfter = IntPtr.Zero;
545551
546- if ((hWnd = getHwndFromPid(pid)) == IntPtr.Zero)
552+ if ((hWnd = getHwndFromPid(pid, classname)) == IntPtr.Zero)
547553 {
548554 return false;
549555 }
@@ -568,15 +574,16 @@ namespace VMwPlayerTaskTray
568574 }
569575
570576 // プロセスID(pid)をウィンドウハンドル(hWnd)に変換する
571- private IntPtr getHwndFromPid(int pid)
577+ private IntPtr getHwndFromPid(int pid, string classname)
572578 {
573579 IntPtr hWnd;
574580 const int GW_HWNDNEXT = 2; // for GetWindow()
575581 // GetAncestor()
576582 // const uint GA_PARENT = 1;
577583 // const uint GA_ROOT = 2;
578- const uint GA_ROOTOWNER = 3;
579- IntPtr parent = IntPtr.Zero, root = IntPtr.Zero, rootowner=IntPtr.Zero;
584+ // const uint GA_ROOTOWNER = 3;
585+ // IntPtr parent = IntPtr.Zero, root = IntPtr.Zero, rootowner=IntPtr.Zero;
586+ StringBuilder csb = new StringBuilder(256);
580587
581588 hWnd = FindWindow(null, null);
582589 while (hWnd != IntPtr.Zero)
@@ -585,13 +592,21 @@ namespace VMwPlayerTaskTray
585592 {
586593 if (pid == getPidFromHwnd(hWnd))
587594 {
588- // return hWnd
589- return rootowner; // 現在のではなくてひとつ前のroot ownerを返す
595+ GetClassName(hWnd, csb, csb.Capacity);
596+ if (0 <= csb.ToString().IndexOf(classname))
597+ {
598+#if DEBUG
599+
600+ Debug.WriteLine("ClassName = " + csb.ToString());
601+#endif
602+ return hWnd;
603+ }
604+ //return rootowner; // 現在のではなくてひとつ前のroot ownerを返す
590605 }
591606 }
592607 // parent = GetAncestor(hWnd, GA_PARENT);
593608 // root = GetAncestor(hWnd, GA_ROOT);
594- rootowner = GetAncestor(hWnd, GA_ROOTOWNER);
609+ // rootowner = GetAncestor(hWnd, GA_ROOTOWNER);
595610 hWnd = GetWindow(hWnd, GW_HWNDNEXT);
596611 }
597612 return IntPtr.Zero;
--- a/VMwPlayerTaskTray/Properties/AssemblyInfo.cs
+++ b/VMwPlayerTaskTray/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
3232 // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
3333 // 既定値にすることができます:
3434 // [assembly: AssemblyVersion("1.0.*")]
35-[assembly: AssemblyVersion("1.1.4.*")]
36-[assembly: AssemblyFileVersion("1.1.4.0")]
35+[assembly: AssemblyVersion("1.1.5.*")]
36+[assembly: AssemblyFileVersion("1.1.5.0")]
--- a/readme.txt
+++ b/readme.txt
@@ -49,6 +49,7 @@ Rlease & modify
4949 Visual Studio Community 2015
5050 Windows10 Professional 64bit.
5151 2015/09/10 1.1.4 Add /pos option, changed Icons.
52+ 2015/09/11 1.1.5 Enabled GO NoGUI but diplaying an error message and going on running.
5253
5354
5455