/// <summary> /// ウィンドウプロシージャ /// </summary> /// <param name="m">Windowsメッセージ</param> protected override void WndProc(ref Message m) { base.WndProc(ref m); switch (m.Msg) { case WinAPI.WM_COPYDATA: // DLLからデータを受信 // 受信したデータを元の型にキャストして、追加する WinAPI.COPYDATASTRUCT_LONG_ARRAY cds = (WinAPI.COPYDATASTRUCT_LONG_ARRAY)Marshal.PtrToStructure(m.LParam, typeof(WinAPI.COPYDATASTRUCT_LONG_ARRAY)); StringBuilder stringBuilder = new StringBuilder(255); long[] dest = new long[255]; for (int i = 0, j = 0; i < cds.lpData.Length; ++i) { if (cds.lpData[i] == 0) { continue; } if (dest.Contains(cds.lpData[i])) { continue; } if (WinAPI.GetWindowText((IntPtr)cds.lpData[i], stringBuilder, stringBuilder.Capacity) == 0) { continue; } dest[j++] = cds.lpData[i]; } GroupManager.AddItems(ref dest); break; case WinAPI.WM_HOTKEY: ShortcutProc.RunAction((int)m.WParam); break; default: break; } }
/// <summary> /// 初期化 /// </summary> public static int Initialize() { try { UpdateScrSize(); GroupManager.Initialize(); MysetManager.Initialize(); //TextIdentifier = "-" + Application.ProductName + "-" + Application.ProductVersion; Launcher = new LauncherForm(); ItemList = new ItemListForm(); MysetList = new MysetListForm(); ItemList.Hide(); MysetList.Hide(); IntPtr h = Launcher.Handle; h = ItemList.Handle; h = MysetList.Handle; ShortcutProc.Initialize(); LoadSetting(); Skin.LoadSkinImages(); MysetManager.LoadMyset(); return(0); } catch { Console.WriteLine("Error: Initializing."); return(-1); } }