internal static IArhiveOperationMasterForm CreateAttachmentWindow(MyChildForm masterForm, WindowInfo masterWindowInfo) { WindowInfo windowInfo = ADInfoBll.Instance.GetWindowInfo("SD_Attachment"); MyForm form = null; if (windowInfo != null && !string.IsNullOrEmpty(masterWindowInfo.AttachmentId)) { form = ServiceProvider.GetService<IWindowFactory>().CreateWindow(windowInfo) as MyForm; masterForm.SetCustomProperty("AttachmentEntityIdExp", masterWindowInfo.AttachmentId); if (form != null) { form.FormClosing += new FormClosingEventHandler(delegate(object sender1, FormClosingEventArgs e1) { e1.Cancel = true; form.Visible = false; }); } //if (form != null) //{ //form.Text = masterForm.Text + "的附件"; //form.Show(); //form.DisplayManager.SearchManager.LoadData(SearchExpression.And( // SearchExpression.Eq("EntityName", entityName), SearchExpression.Eq("EntityId", entityId)), null); //(form.ControlManager.Dao as BaseDao<AttachmentInfo>).EntityOperating += new EventHandler<OperateArgs<AttachmentInfo>>(delegate(object sender1, OperateArgs<AttachmentInfo> e1) //{ // e1.Entity.EntityName = entityName; // e1.Entity.EntityId = entityId; //}); //} } return form as IArhiveOperationMasterForm; }
//private System.Windows.Forms.ToolStrip m_toolStripMaster, m_toolStripDetail; //private List<System.Windows.Forms.ToolStripItem> m_tsbsMaster = new List<System.Windows.Forms.ToolStripItem>(); //private List<System.Windows.Forms.ToolStripItem> m_tsbsDetail = new List<System.Windows.Forms.ToolStripItem>(); public GeneratedArchiveSeeForm(WindowInfo windowInfo, DataGridType dataGridType) : base(dataGridType == DataGridType.DataUnboundGridLoadOnDemand ? (MyGrid)(new DataUnboundWithDetailGridLoadOnDemand()) : (dataGridType == DataGridType.DataBoundGridLoadOnDemand ? (MyGrid)(new DataBoundWithDetailGridLoadOnDemand()) : (dataGridType == DataGridType.DataUnboundGridLoadOnce ? (MyGrid)(new DataUnboundWithDetailGridLoadonce()) : null))) { Initialize(windowInfo); }
static Rectangle GetVisibleRectangle(WindowInfo wi, Screen s) { Rectangle resultWindowRect = new Rectangle( wi.rcWindow.left, wi.rcWindow.top, wi.rcWindow.right - wi.rcWindow.left, wi.rcWindow.bottom - wi.rcWindow.top ); WindowBorderOnScreenFlags flags = new WindowBorderOnScreenFlags(wi, s); if(!flags.leftBorderOnScreen) resultWindowRect.X = s.WorkingArea.X; else { resultWindowRect.X = !flags.rightBorderOnScreen ? s.WorkingArea.Right - wi.rcWindow.right + wi.rcWindow.left : wi.rcWindow.left; } if(!flags.topBorderOnScreen) resultWindowRect.Y = s.WorkingArea.Y; else { resultWindowRect.Y = !flags.bottomBorderOnScreen ? s.WorkingArea.Bottom - wi.rcWindow.bottom + wi.rcWindow.top : wi.rcWindow.top; } return resultWindowRect; }
public GeneratedArchiveExcelForm(WindowInfo windowInfo) { this.Name = windowInfo.Name; this.Text = windowInfo.Text; IList<WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); if (tabInfos == null) { throw new ArgumentException("there is no windowTab with windowId of " + windowInfo.Name); } if (tabInfos.Count == 0) { throw new ArgumentException("There should be at least one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } if (tabInfos.Count > 1) { throw new ArgumentException("There should be at most one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } ISearchManager sm = ServiceProvider.GetService<IManagerFactory>().GenerateSearchManager(tabInfos[0], null); IBaseDao daoParent = ServiceProvider.GetService<IManagerFactory>().GenerateBusinessLayer(tabInfos[0]); IWindowControlManager cmMaster = ServiceProvider.GetService<IManagerFactory>().GenerateControlManager(tabInfos[0], sm) as IWindowControlManager; cmMaster.Dao = daoParent; base.ControlManager = cmMaster; this.MasterGrid.GridName = tabInfos[0].GridName; this.ExcelGrid.BeginInitialize(); CreateGridColumns(this.MasterGrid); this.ExcelGrid.EndInitialize(); this.ExcelGrid.SetColumnManagerRowHorizontalAlignment(); // 不需要。和ArchiveOperationForm同一个WindowInfo,会出错 //GeneratedArchiveSeeForm.InitializeWindowProcess(windowInfo, this); }
public void TwoConsecutiveCallsWhichReturnsMessageBuffersShouldNotBeSame() { var message = new WindowInfo(56, 67, 60, 71); var messageBuffer1 = message.ToBytes(); var messageBuffer2 = message.ToBytes(); Assert.AreNotSame(messageBuffer1, messageBuffer2); }
public void BaseInit(int moduleId, int instanceId, GameObject root) { m_wiInfo = WindowInfoMgr.GetWindowInfo(moduleId); m_iInstanceID = instanceId; m_objInstanceRoot = root; m_transInstanceRoot = root.GetComponent<RectTransform>(); m_ticker = m_objInstanceRoot.AddComponent<Ticker>(); }
public static WindowInfo getWindowInfo(IntPtr hwnd) { WindowInfo info = new WindowInfo(); //info.cbSize = (uint)Marshal.SizeOf(info); GetWindowInfo(hwnd, ref info); info.handle = hwnd; return info; }
public void ShouldAbleToRetriveVariablesFromBytes() { var messageBuffer = new byte[] { 56, 0, 0, 0, 67, 0, 0, 0, 60, 0, 0, 0, 71, 0, 0, 0 }; var message = new WindowInfo(messageBuffer); Assert.AreEqual(56, message.Left); Assert.AreEqual(67, message.Right); Assert.AreEqual(60, message.Top); Assert.AreEqual(71, message.Bottom); }
public GeneratedArchiveDatabaseReportForm(WindowInfo windowInfo) { this.Name = windowInfo.Name; this.Text = windowInfo.Text; IList<WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); if (tabInfos == null) { throw new ArgumentException("there is no windowTab with windowId of " + windowInfo.Name); } if (tabInfos.Count == 0) { throw new ArgumentException("There should be at least one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } if (tabInfos.Count > 1) { throw new ArgumentException("There should be at most one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } ISearchManager smMaster = ServiceProvider.GetService<IManagerFactory>().GenerateSearchManager(tabInfos[0], null); IDisplayManager dmMaster = ServiceProvider.GetService<IManagerFactory>().GenerateDisplayManager(tabInfos[0], smMaster); smMaster.DataLoading += new EventHandler<DataLoadingEventArgs>(smMaster_DataLoading); ReportInfo reportInfo = ADInfoBll.Instance.GetReportInfo(windowInfo.Name); CrystalDecisions.CrystalReports.Engine.ReportDocument reportDocument = ReportHelper.CreateReportDocument(reportInfo.ReportDocument); this.ReportViewer.CrystalHelper.ReportSource = reportDocument; // Now only support Sql System.Data.SqlClient.SqlConnectionStringBuilder builder = new System.Data.SqlClient.SqlConnectionStringBuilder(); builder.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[SecurityHelper.DataConnectionStringName].ConnectionString; this.ReportViewer.CrystalHelper.ServerName = builder.DataSource; this.ReportViewer.CrystalHelper.DatabaseName = builder.InitialCatalog; this.ReportViewer.CrystalHelper.UserId = builder.UserID; this.ReportViewer.CrystalHelper.Password = builder.Password; this.ReportViewer.CrystalHelper.IntegratedSecurity = builder.IntegratedSecurity; GeneratedArchiveSeeForm.InitializeWindowProcess(windowInfo, this); ArchiveSearchForm searchForm = null; this.SetSearchPanel(() => { if (searchForm == null) { searchForm = new ArchiveSearchForm(this, smMaster, tabInfos[0]); } return searchForm; }); }
public void ShouldAbleToBytesFromRetriveVariables() { var message = new WindowInfo(56, 67, 60, 71); var messageBuffer = new byte[] { 56, 0, 0, 0, 67, 0, 0, 0, 60, 0, 0, 0, 71, 0, 0, 0 }; var messageBufferToCompare = message.ToBytes(); Assert.AreEqual(messageBuffer.Length, messageBufferToCompare.Length); for (var i = 0; i < messageBuffer.Length; i++) { if (messageBuffer[i] != messageBufferToCompare[i]) Assert.Fail("Message contents is not same"); } }
static void Main(string[] args) { if(args.Length < 1) { Console.Error.Write("Incorrect arguments"); Environment.Exit(1); } IntPtr hwnd = (IntPtr)Convert.ToInt32(args[0]); WindowInfo wi = new WindowInfo(); GetWindowInfo(hwnd, ref wi); Console.Out.WriteLine(wi.rcWindow.right - wi.rcWindow.left); Console.Out.WriteLine(wi.rcWindow.bottom - wi.rcWindow.top); }
public GeneratedArchiveCheckForm(WindowInfo windowInfo) : base() { this.Name = windowInfo.Name; this.Text = windowInfo.Text; IList<WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); if (tabInfos == null) { throw new ArgumentException("there is no windowTab with windowId of " + windowInfo.Name); } if (tabInfos.Count == 0) { throw new ArgumentException("There should be at least one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } if (tabInfos.Count > 1) { throw new ArgumentException("There should be at most one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } ISearchManager smMaster = ServiceProvider.GetService<IManagerFactory>().GenerateSearchManager(tabInfos[0], null); IDisplayManager dmMaster; if (!string.IsNullOrEmpty(tabInfos[0].DisplayManagerClassName)) { dmMaster = ServiceProvider.GetService<IManagerFactory>().GenerateDisplayManager(tabInfos[0], smMaster); } else { dmMaster = (ServiceProvider.GetService<IManagerFactory>().GenerateControlManager(tabInfos[0], smMaster)).DisplayManager; } (base.MasterGrid as IBoundGrid).SetDisplayManager(dmMaster, tabInfos[0].GridName); ArchiveSearchForm searchForm = null; this.SetSearchPanel(() => { if (searchForm == null) { searchForm = new ArchiveSearchForm(this, smMaster, tabInfos[0]); } return searchForm; }); // in CheckWindow, no page smMaster.EnablePage = false; GeneratedArchiveSeeForm.InitializeWindowProcess(windowInfo, this); }
//public static ArchiveDetailForm GenerateArchiveDetailForm(WindowInfo windowInfo) //{ // return GenerateArchiveDetailForm(windowInfo, null); //} public static ArchiveDetailForm GenerateArchiveDetailForm(WindowInfo windowInfo) { ArchiveDetailForm ret = null; IList<WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); if (tabInfos.Count == 0) { throw new ArgumentException("there should be winTab infos in window of " + windowInfo.Name); } ISearchManager sm = ServiceProvider.GetService<IManagerFactory>().GenerateSearchManager(tabInfos[0], null); IWindowControlManager cmParent = null; if (string.IsNullOrEmpty(tabInfos[0].ControlManagerClassName)) { IDisplayManager dmParent = ServiceProvider.GetService<IManagerFactory>().GenerateDisplayManager(tabInfos[0], sm); ret = GenerateArchiveDetailForm(windowInfo, dmParent); } else { cmParent = ServiceProvider.GetService<IManagerFactory>().GenerateControlManager(tabInfos[0], sm) as IWindowControlManager; IBaseDao daoParent = ServiceProvider.GetService<IManagerFactory>().GenerateBusinessLayer(tabInfos[0]); cmParent.Dao = daoParent; ret = GenerateArchiveDetailForm(windowInfo, cmParent, daoParent as IRelationalDao); } ret.Text = windowInfo.Text; ret.Name = windowInfo.Name; ArchiveSearchForm searchForm = null; ret.SetSearchPanel(() => { if (searchForm == null) { searchForm = new ArchiveSearchForm(ret, sm, tabInfos[0]); if (cmParent != null) { cmParent.StateControls.Add(searchForm); } } return searchForm; }); return ret; }
static Bitmap CaptureFromScreen(IntPtr hwnd, WindowInfo wi) { IntPtr fgHwnd = GetForegroundWindow(); if(fgHwnd != hwnd) ForegroundWindow(hwnd); Bitmap windowBitmap = new Bitmap(wi.rcWindow.right - wi.rcWindow.left, wi.rcWindow.bottom - wi.rcWindow.top, System.Drawing.Imaging.PixelFormat.Format32bppRgb); Graphics graphicsWindow = Graphics.FromImage(windowBitmap); graphicsWindow.CopyFromScreen(new Point(wi.rcWindow.left, wi.rcWindow.top), Point.Empty, windowBitmap.Size, CopyPixelOperation.SourceCopy); if(fgHwnd != hwnd) ForegroundWindow(fgHwnd); return windowBitmap; }
static WindowInfo GetWindowInfo(IntPtr hwnd, string browser) { WindowInfo wi = new WindowInfo(); GetWindowInfo(hwnd, ref wi); if(browser == "chrome") { IntPtr hostHWND = FindWindowEx(hwnd, IntPtr.Zero, "Chrome_RenderWidgetHostHWND", IntPtr.Zero); if(hostHWND != IntPtr.Zero) GetWindowRect(hostHWND, ref wi.rcClient); } else if(browser == "firefox") { // NOTE: Window client area has border wi.rcClient.top += 1; // NOTE: For client area in FireFox v28 and lower this border is absent. wi.rcClient.left += 1; wi.rcClient.bottom -= 1; wi.rcClient.right -= 1; } else if(browser == "ie") { IntPtr hChildWnd = GetWindow(hwnd, GW_CHILD); StringBuilder sb = new StringBuilder(256); IntPtr tempHwnd = hwnd; while(tempHwnd != IntPtr.Zero) { GetClassName(hwnd.ToInt32(), sb, 256); if(sb.ToString().IndexOf("Shell DocObject View", 0) > -1) { tempHwnd = FindWindowEx(tempHwnd, IntPtr.Zero, "Internet Explorer_Server", IntPtr.Zero); break; } tempHwnd = GetWindow(tempHwnd, GW_HWNDNEXT); } GetWindowRect(tempHwnd, ref wi.rcClient); } if(wi.rcWindow.left < 0 && wi.rcWindow.right < 0 && wi.rcWindow.top < 0 && wi.rcWindow.bottom < 0) { Console.Error.Write("Window is not on the screen"); Environment.Exit(1); } return wi; }
private static System.Collections.Generic.IEnumerable<WindowInfo> GatAllDesktopWindows() { var wndList = new System.Collections.Generic.List<WindowInfo>(); //enum all desktop windows EnumWindows(delegate(System.IntPtr hWnd, int lParam) { var wnd = new WindowInfo(); var sb = new System.Text.StringBuilder(256); //get hwnd //get window name GetWindowTextW(hWnd, sb, sb.Capacity); wnd.SzWindowName = sb.ToString(); //get window class GetClassNameW(hWnd, sb, sb.Capacity); //add it into list 你可以在这里修改 过滤你要的控件进入列表 wndList.Add(wnd); return true; }, 0); return wndList.ToArray(); }
public RepositionWindowInfo( WindowInfo toPosition ) { ToPosition = toPosition; _originalVisible = toPosition.IsVisible(); Visible = _originalVisible; var placement = new User32.WindowPlacement(); User32.GetWindowPlacement( toPosition.Handle, ref placement ); User32.Rectangle position = placement.NormalPosition; _originalX = position.Left; X = _originalX; _originalY = position.Top; Y = _originalY; // TODO: According to the documentation, the pixel at (right, bottom) lies immediately outside the rectangle. Do we need to subtract with 1? _originalWidth = position.Right - position.Left; Width = _originalWidth; _originalHeight = position.Bottom - position.Top; Height = _originalHeight; }
/// <summary> /// 解析。 /// </summary> /// <param name="handle">ハンドル。</param> /// <param name="analyzer">別システムウィンドウ解析。</param> /// <returns>解析結果。</returns> public static WindowInfo Analyze(IntPtr handle, IOtherSystemWindowAnalyzer[] analyzer) { //子ウィンドウを全て取得する List<IntPtr> children = new List<IntPtr>(); NativeMethods.EnumWindowsDelegate callback = delegate(IntPtr hWnd, IntPtr lParam) { children.Add(hWnd); return 1; }; NativeMethods.EnumChildWindows(handle, callback, IntPtr.Zero); GC.KeepAlive(callback); //ウィンドウ情報を取得する WindowInfo info = new WindowInfo(); info.Handle = handle; NativeMethods.RECT rc = new NativeMethods.RECT(); NativeMethods.GetWindowRect(handle, ref rc); List<int> zIndex = new List<int>(); GetWindowInfo(new Point(rc.left, rc.top), info, children, zIndex, analyzer); return info; }
public WindowInfo[] GetAllDesktopWindows() { List<WindowInfo> wndList = new List<WindowInfo>(); //enum all desktop windows EnumWindows(delegate(IntPtr hWnd, int lParam) { WindowInfo wnd = new WindowInfo(); StringBuilder sb = new StringBuilder(256); //get hwnd wnd.hWnd = hWnd; //get window name GetWindowTextW(hWnd, sb, sb.Capacity); wnd.szWindowName = sb.ToString(); //get window class GetClassNameW(hWnd, sb, sb.Capacity); wnd.szClassName = sb.ToString(); //add it into list wndList.Add(wnd); return true; }, 0); return wndList.ToArray(); }
public GeneratedArchiveDataControlForm(WindowInfo windowInfo) : base() { this.Name = windowInfo.Name; this.Text = windowInfo.Text; IList<WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); if (tabInfos == null) { throw new ArgumentException("there is no windowTab with windowId of " + windowInfo.Name); } if (tabInfos.Count == 0) { throw new ArgumentException("There should be at least one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } if (tabInfos.Count > 1) { throw new ArgumentException("There should be at most one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } IControlManager cmMaster = ServiceProvider.GetService<IManagerFactory>().GenerateControlManager(tabInfos[0], null); base.Initialize(cmMaster, ADInfoBll.Instance.GetGridColumnInfos(tabInfos[0].GridName)); }
//protected override void Dispose(bool disposing) //{ // if (disposing) // { // } // base.Dispose(disposing); //} public GeneratedDataUnboundGrid(WindowInfo windowInfo) : base() { this.FixedHeaderRows.Add(new Xceed.Grid.ColumnManagerRow()); this.Name = windowInfo.Name; this.Text = windowInfo.Text; IList<WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); if (tabInfos == null) { throw new ArgumentException("there is no windowTab with windowId of " + windowInfo.Name); } if (tabInfos.Count == 0) { throw new ArgumentException("There should be at least one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } if (tabInfos.Count > 1) { throw new ArgumentException("There should be at most one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } Initialize(tabInfos[0], null); }
private void InitializeControls(WindowInfo windowInfo, SmartSystemMenuSettings settings) { grpWindow.Text = settings.LanguageSettings.GetValue("grp_window"); grpProcess.Text = settings.LanguageSettings.GetValue("grp_process"); lblGetWindowText.Text = settings.LanguageSettings.GetValue("lbl_get_window_text"); lblWmGetText.Text = settings.LanguageSettings.GetValue("lbl_wm_gettext"); lblGetClassName.Text = settings.LanguageSettings.GetValue("lbl_get_class_name"); lblRealGetWindowClass.Text = settings.LanguageSettings.GetValue("lbl_real_get_window_class"); lblFontName.Text = settings.LanguageSettings.GetValue("lbl_font_name"); lblWindowHandle.Text = settings.LanguageSettings.GetValue("lbl_window_handle"); lblParentWindowHandle.Text = settings.LanguageSettings.GetValue("lbl_parent_window_handle"); lblWindowSize.Text = settings.LanguageSettings.GetValue("lbl_window_size"); lblInstance.Text = settings.LanguageSettings.GetValue("lbl_instance"); lblProcessId.Text = settings.LanguageSettings.GetValue("lbl_process_id"); lblThreadId.Text = settings.LanguageSettings.GetValue("lbl_thread_id"); lblGclWndProc.Text = settings.LanguageSettings.GetValue("lbl_gcl_wnd_proc"); lblDwlDlgProc.Text = settings.LanguageSettings.GetValue("lbl_dwl_dlg_proc"); lblGwlStyle.Text = settings.LanguageSettings.GetValue("lbl_gwl_style"); lblGclStyle.Text = settings.LanguageSettings.GetValue("lbl_gcl_style"); lblGwlExStyle.Text = settings.LanguageSettings.GetValue("lbl_gwl_exstyle"); lblWindowInfoExStyle.Text = settings.LanguageSettings.GetValue("lbl_windowinfo_exstyle"); lblLwaAlpha.Text = settings.LanguageSettings.GetValue("lbl_lwa_alpha"); lblLwaColorKey.Text = settings.LanguageSettings.GetValue("lbl_lwa_colorkey"); lblGwlUserData.Text = settings.LanguageSettings.GetValue("lbl_gwl_userdata"); lblDwlUser.Text = settings.LanguageSettings.GetValue("lbl_dwl_user"); lblFullPath.Text = settings.LanguageSettings.GetValue("lbl_full_path"); lblCommandLine.Text = settings.LanguageSettings.GetValue("lbl_command_line"); lblStartedAt.Text = settings.LanguageSettings.GetValue("lbl_started_at"); lblOwner.Text = settings.LanguageSettings.GetValue("lbl_owner"); lblThreads.Text = settings.LanguageSettings.GetValue("lbl_threads"); lblWorkingSetSize.Text = settings.LanguageSettings.GetValue("lbl_working_set_size"); lblParent.Text = settings.LanguageSettings.GetValue("lbl_parent"); lblPriority.Text = settings.LanguageSettings.GetValue("lbl_priority"); lblHandles.Text = settings.LanguageSettings.GetValue("lbl_handles"); lblVirtualSize.Text = settings.LanguageSettings.GetValue("lbl_virtual_size"); lblProductName.Text = settings.LanguageSettings.GetValue("lbl_product_name"); lblCopyright.Text = settings.LanguageSettings.GetValue("lbl_copyright"); lblFileVersion.Text = settings.LanguageSettings.GetValue("lbl_file_version"); lblProductVersion.Text = settings.LanguageSettings.GetValue("lbl_product_version"); btnOk.Text = settings.LanguageSettings.GetValue("information_btn_apply"); Text = settings.LanguageSettings.GetValue("information"); var nfi = (NumberFormatInfo)CultureInfo.InvariantCulture.NumberFormat.Clone();; nfi.NumberGroupSeparator = ","; txtGetWindowText.Text = windowInfo.GetWindowText; txtWmGetText.Text = windowInfo.WM_GETTEXT; txtGetClassName.Text = windowInfo.GetClassName; txtRealGetWindowClass.Text = windowInfo.RealGetWindowClass; txtFontName.Text = windowInfo.FontName; txtWindowHandle.Text = string.Format("0x{0:X}", windowInfo.Handle.ToInt64()); txtParentWindowHandle.Text = string.Format("0x{0:X}", windowInfo.ParentHandle.ToInt64()); txtWindowSize.Text = string.Format("{0} x {1}", windowInfo.Size.Width, windowInfo.Size.Height); txtInstance.Text = string.Format("0x{0:X}", windowInfo.Instance.ToInt64()); txtProcessId.Text = string.Format("0x{0:X} ({0})", windowInfo.ProcessId); txtThreadId.Text = string.Format("0x{0:X} ({0})", windowInfo.ThreadId); txtGclWndProc.Text = string.Format("0x{0:X}", windowInfo.GCL_WNDPROC); txtDwlDlgProc.Text = string.Format("0x{0:X}", windowInfo.DWL_DLGPROC); txtGwlStyle.Text = string.Format("0x{0:X}", windowInfo.GWL_STYLE); txtGclStyle.Text = string.Format("0x{0:X}", windowInfo.GCL_STYLE); txtGwlExStyle.Text = string.Format("0x{0:X}", windowInfo.GWL_EXSTYLE); txtWindowInfoExStyle.Text = string.Format("0x{0:X}", windowInfo.WindowInfoExStyle); txtLwaAlpha.Text = windowInfo.LWA_ALPHA ? "+" : "-"; txtLwaColorKey.Text = windowInfo.LWA_COLORKEY ? "+" : "-"; txtGwlUserData.Text = string.Format("0x{0:X}", windowInfo.GWL_USERDATA); txtDwlUser.Text = string.Format("0x{0:X}", windowInfo.DWL_USER); txtFullPath.Text = windowInfo.FullPath; txtCommandLine.Text = windowInfo.CommandLine; txtStartedAt.Text = windowInfo.StartTime == null ? "" : windowInfo.StartTime.Value.ToString("dd.MM.yyyy HH:mm:ss"); txtOwner.Text = windowInfo.Owner; txtParent.Text = windowInfo.Parent; txtPriority.Text = windowInfo.Priority.ToString(); txtThreads.Text = windowInfo.ThreadCount.ToString(); txtHandles.Text = windowInfo.HandleCount.ToString(); txtWorkingSetSize.Text = ((decimal)windowInfo.WorkingSetSize).ToString("#,0", nfi); txtVirtualSize.Text = ((decimal)windowInfo.VirtualSize).ToString("#,0", nfi); txtProductName.Text = windowInfo.ProductName; txtCopyright.Text = windowInfo.Copyright; txtFileVersion.Text = windowInfo.FileVersion; txtProductVersion.Text = windowInfo.ProductVersion; }
private void BgwScriptPetDoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { while (botRunning) { #region pet: BST if (PlayerInfo.MainJob == 9 || PlayerInfo.SubJob == 9) { if (juguse.Checked && PetInfo.ID == 0 && jugpet.Text != "" && ItemQuantityByName(jugpet.Text) > 0) { #region Ammo/Ranged Slot var rangedSlot = InventoryItems.Items.FirstOrDefault(x => x.Key == api.Inventory.GetEquippedItem(2).Id.ToString()).Value; var ammoSlot = InventoryItems.Items.FirstOrDefault(x => x.Key == api.Inventory.GetEquippedItem(3).Id.ToString()).Value; #endregion if (Recast.GetAbilityRecast(94) == 0) { WindowInfo.SendText("/equip Ammo \"" + jugpet.Text + "\""); Thread.Sleep(TimeSpan.FromSeconds(1.0)); WindowInfo.SendText("/ja \"Bestial Loyalty\" <me>"); Thread.Sleep(TimeSpan.FromSeconds(2.0)); } else if (Recast.GetAbilityRecast(104) == 0 && Recast.GetAbilityRecast(94) != 0) { WindowInfo.SendText("/equip Ammo \"" + jugpet.Text + "\""); Thread.Sleep(TimeSpan.FromSeconds(1.0)); WindowInfo.SendText("/ja \"Call Beast\" <me>"); Thread.Sleep(TimeSpan.FromSeconds(2.0)); } #region Re-Equip Ammo/Ranged if (ammoSlot != null && ammoSlot != jugpet.Text) { WindowInfo.SendText("/equip Ammo \"" + ammoSlot + "\""); Thread.Sleep(TimeSpan.FromSeconds(1.0)); } else if (rangedSlot != null) { WindowInfo.SendText("/equip Range \"" + rangedSlot + "\""); Thread.Sleep(TimeSpan.FromSeconds(1.0)); } #endregion if (TargetInfo.ID > 0 && TargetInfo.ID != PlayerInfo.ServerID && !TargetInfo.LockedOn) { WindowInfo.SendText("/lockon <t>"); } } if (PetInfo.Name != null) { pInfo(); } if (PetInfo.ID > 0 && autoengage.Checked && PlayerInfo.Status == 1 && PetInfo.Status == 0 && TargetInfo.ID > 0) { WindowInfo.SendText("/ja \"Fight\" <t>"); Thread.Sleep(TimeSpan.FromSeconds(4.0)); } if (petfooduse.Checked && ItemQuantityByName(usedpetfood.Text) > 0 && PetInfo.ID > 0 && usedpetfood.Text != "" && PetInfo.HPP < pethppfood.Value && Recast.GetAbilityRecast(103) == 0) { #region Ammo/Ranged Slot var rangedSlot = InventoryItems.Items.FirstOrDefault(x => x.Key == api.Inventory.GetEquippedItem(2).Id.ToString()).Value; var ammoSlot = InventoryItems.Items.FirstOrDefault(x => x.Key == api.Inventory.GetEquippedItem(3).Id.ToString()).Value; #endregion WindowInfo.SendText("/equip Ammo \"" + usedpetfood.Text + "\""); Thread.Sleep(TimeSpan.FromSeconds(2.0)); WindowInfo.SendText("/ja \"Reward\" <me>"); Thread.Sleep(TimeSpan.FromSeconds(2.0)); #region Re-Equip Ammo/Ranged if (ammoSlot != null && ammoSlot != usedpetfood.Text) { WindowInfo.SendText("/equip Ammo \"" + ammoSlot + "\""); Thread.Sleep(TimeSpan.FromSeconds(2.0)); } else if (rangedSlot != null) { WindowInfo.SendText("/equip Range \"" + rangedSlot + "\""); Thread.Sleep(TimeSpan.FromSeconds(2.0)); } #endregion } if (PetJA.Items.Count == 0 && PetInfo.ID != 0) { BSTGetJA(); } if (PetInfo.ID > 0 && PetJA.Items.Count > 0 && PetInfo.Status == 1 && PetInfo.TPP > 1000 && TargetInfo.ID > 0) { PetReadyJA(); } } #endregion #region pet: DRG if (PlayerInfo.MainJob == 14 || PlayerInfo.SubJob == 14) { if (PetInfo.ID == 0 && CallWyvern.Checked && Recast.GetAbilityRecast(163) == 0) { WindowInfo.SendText("/ja \"Call Wyvern\" <me>"); Thread.Sleep(TimeSpan.FromSeconds(2.0)); } if (PetInfo.ID != 0) { pInfo(); } if (WyvernJA.Items.Count == 0 && PetInfo.ID > 0) { WyvernGetJA(); } if (PetInfo.ID > 0 && WyvernJA.Items.Count > 0 && PlayerInfo.Status == 1 && !string.IsNullOrEmpty(TargetInfo.Name)) { WyvernUseJA(); } } #endregion Thread.Sleep(TimeSpan.FromSeconds(0.1)); } }
/// <summary> /// Creates the content to display on information window /// </summary> /// <param name="title">Information window title</param> /// <param name="subtitle">Information window subtitle</param> /// <param name="info">Information window description</param> static void SetWindowContent(string title, string subtitle, string info) { WindowInfo.SetWindowInfo(title, subtitle, info); }
private static extern bool GetWindowInfo(IntPtr hWnd, ref WindowInfo info);
private void Initialize(WindowInfo windowInfo) { this.Name = windowInfo.Name; this.Text = windowInfo.Text; IList <WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); if (tabInfos == null) { throw new ArgumentException("there is no windowTab with windowId of " + windowInfo.Name); } if (tabInfos.Count == 0) { throw new ArgumentException("There should be at least one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } if (tabInfos.Count > 1) { throw new ArgumentException("There should be at most one TabInfo in WindowInfo with name is " + windowInfo.Name + "!"); } ISearchManager smMaster = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(tabInfos[0], null); IWindowControlManager cmMaster = ServiceProvider.GetService <IManagerFactory>().GenerateControlManager(tabInfos[0], smMaster) as IWindowControlManager; IBaseDao daoParent = ServiceProvider.GetService <IManagerFactory>().GenerateBusinessLayer(tabInfos[0]); cmMaster.Dao = daoParent; ((IArchiveGrid)base.MasterGrid).SetControlManager(cmMaster, tabInfos[0].GridName); // daoParent's subDao is inserted in detailForm if (base.MasterGrid is IBoundGridWithDetailGridLoadOnDemand) { ArchiveFormFactory.GenerateDetailGrids(base.MasterGrid as IBoundGridWithDetailGridLoadOnDemand, tabInfos[0]); } // Load Additional Menus IList <WindowMenuInfo> windowMenuInfos = ADInfoBll.Instance.GetWindowMenuInfo(windowInfo.Name); IList <WindowMenuInfo> masterWindowMenuInfos; IList <WindowMenuInfo> detailWindowMenuInfos; GeneratedArchiveSeeForm.SplitWindowMenu(windowMenuInfos, out masterWindowMenuInfos, out detailWindowMenuInfos); if (masterWindowMenuInfos.Count > 0) { this.GenerateWindowMenu(masterWindowMenuInfos); } if (windowInfo.GenerateDetailForm) { if (windowInfo.DetailForm != null) { m_detailForm = ArchiveFormFactory.CreateForm(ADInfoBll.Instance.GetFormInfo(windowInfo.DetailForm.Name)) as IArchiveDetailForm; if (windowInfo.DetailWindow == null) { ArchiveFormFactory.GenerateArchiveDetailForm(windowInfo, cmMaster, daoParent, null, m_detailForm); } } // 和主窗体不关联 else if (windowInfo.DetailWindow != null) { WindowInfo detailWindowInfo = ADInfoBll.Instance.GetWindowInfo(windowInfo.DetailWindow.Name); m_detailForm = ServiceProvider.GetService <IWindowFactory>().CreateWindow(detailWindowInfo) as IArchiveDetailForm; var searchWindow = m_detailForm.GetCustomProperty(MyChildForm.SearchPanelName) as ArchiveSearchForm; if (searchWindow != null) { searchWindow.EnableProgressForm = false; } } else { m_detailForm = ArchiveFormFactory.GenerateArchiveDetailForm(windowInfo, cmMaster, daoParent as IRelationalDao); } if (m_detailForm != null) { //m_detailWindow.ParentArchiveForm = this; // Generate DetailForm's Menu if (detailWindowMenuInfos.Count > 0) { m_detailForm.GenerateWindowMenu(detailWindowMenuInfos); m_detailForm.VisibleChanged += new EventHandler(m_detailForm_VisibleChanged); } } } ArchiveSearchForm searchForm = null; this.SetSearchPanel(() => { if (searchForm == null) { searchForm = new ArchiveSearchForm(this, smMaster, tabInfos[0]); if (cmMaster != null) { cmMaster.StateControls.Add(searchForm); } } return(searchForm); }); m_attachmentForm = GeneratedArchiveSeeForm.CreateAttachmentWindow(this, windowInfo); GeneratedArchiveSeeForm.InitializeWindowProcess(windowInfo, this); m_windowInfo = windowInfo; }
private void windowCaptureButton_WindowCaptured( IntPtr hWnd ) { int capacity = WinAPI.GetWindowTextLength( hWnd ) * 2; StringBuilder stringBuilder = new StringBuilder( capacity ); WinAPI.GetWindowText( hWnd, stringBuilder, stringBuilder.Capacity ); if ( MessageBox.Show( stringBuilder.ToString() + "\r\n" + FormWindowCapture.WARNING_MESSAGE, "ウィンドウキャプチャの確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question ) == System.Windows.Forms.DialogResult.Yes ) { Attach( hWnd, false ); WindowData = WindowInfoFromHandle( hWnd ); } }
void StartCapture() { Hide(); ExternalWindow?.Hide(); StatusImageSize.Text = ""; // make sure windows actually hides before we wait WindowUtilities.DoEvents(); // Display counter if (CaptureDelaySeconds > 0) { IsPreviewCapturing = true; Cancelled = false; var counterForm = new ScreenOverlayCounter(); try { counterForm.Show(); counterForm.Topmost = true; counterForm.SetWindowText("1"); for (int i = CaptureDelaySeconds; i > 0; i--) { counterForm.SetWindowText(i.ToString()); WindowUtilities.DoEvents(); for (int j = 0; j < 100; j++) { Thread.Sleep(10); WindowUtilities.DoEvents(); } if (Cancelled) { CancelCapture(true); return; } } } finally { counterForm.Close(); IsPreviewCapturing = false; Cancelled = true; } } IsMouseClickCapturing = true; Desktop = new ScreenOverlayDesktop(this); Desktop.SetDesktop(IncludeCursor); Desktop.Show(); WindowUtilities.DoEvents(); Overlay = new ScreenClickOverlay(this) { Width = 0, Height = 0 }; Overlay.Show(); LastWindow = null; CaptureTimer = new Timer(Capture, null, 0, 200); }
public override void Destroy() { Context.Dispose(); WindowInfo.Dispose(); }
private void RuntimeEditor_Closing(object sender, CancelEventArgs e) { HideBalloon(); WindowInfo.Save(this); }
/// <summary> /// Change the alpha value of a window handle. /// /// If the window has not been 'transparenticized', it will be /// </summary> /// <param name="windowHandle">The window handle</param> /// <param name="change">The change in the alpha value</param> /// <returns>true if successful</returns> protected bool ChangeAlpha(IntPtr windowHandle, short change) { if (windowHandle == IntPtr.Zero) { return(false); } // Do we know this window? WindowInfo window = null; if (!this.hijackedWindows.ContainsKey(windowHandle)) { // No - hijack it window = HijackWindow(windowHandle); // Start with the default transparency value if (!SetLayeredWindowAttributes(windowHandle, 0, this.semiTransparentValue, LWA_ALPHA)) { this.notifyIcon.ShowBalloonTip(3000, "See Through Windows", "Could not set transparency on this window", ToolTipIcon.Error); } } else { // Yes, get the window information window = this.hijackedWindows[windowHandle]; } // Get the alpha value of the window int transparentColor; int action; short originalAlpha; if (!GetLayeredWindowAttributes(windowHandle, out transparentColor, out originalAlpha, out action)) { this.notifyIcon.ShowBalloonTip(3000, "See Through Windows", "Could not get transparency of this window", ToolTipIcon.Error); return(false); } else { // Treat 255 as 256 for a nice decrease by step 16 if (originalAlpha == 255) { originalAlpha = 256; } // Update the alpha value short newAlpha = (short)(originalAlpha + change); // Maximinze/minimize to 0-255 if (newAlpha > 255) { newAlpha = 255; } else if (newAlpha < 0) { newAlpha = 0; } // Try to apply new alpha if (!SetLayeredWindowAttributes(windowHandle, 0, newAlpha, LWA_ALPHA)) { this.notifyIcon.ShowBalloonTip(3000, "See Through Windows", "Could not set transparency on this window", ToolTipIcon.Error); return(false); } else { // Update the aplha value. Unused so far but hey window.CurrentAlpha = newAlpha; return(true); } } }
/// <summary> /// The hotkey was pressed! Handle it /// </summary> private void UserHotkey_Pressed(object sender, HandledEventArgs e) { IntPtr activeWindowHandle = GetForegroundWindow(); if (activeWindowHandle != IntPtr.Zero) { if (activeWindowHandle == GetShellWindow()) { this.notifyIcon.ShowBalloonTip(3000, "See Through Windows", "Cannot make desktop transparent", ToolTipIcon.Warning); return; } // Do we know this window? WindowInfo window = null; if (this.hijackedWindows.ContainsKey(activeWindowHandle)) { window = this.hijackedWindows[activeWindowHandle]; } else { window = HijackWindow(activeWindowHandle); } short newAlpha = window.CurrentAlpha; // Toggle the alpha value betwee OPAQUE and semitransparent if (newAlpha == OPAQUE) { newAlpha = this.semiTransparentValue; } else { newAlpha = OPAQUE; } if (!SetLayeredWindowAttributes(activeWindowHandle, 0, newAlpha, LWA_ALPHA)) { this.notifyIcon.ShowBalloonTip(3000, "See Through Windows", "Could not set transparency on this window", ToolTipIcon.Error); } else { window.CurrentAlpha = newAlpha; // Also make window topmost if specified if (this.clickThroughCheckBox.Checked && this.topMostCheckBox.Checked) { SetWindowPos(activeWindowHandle, new IntPtr(HWND_TOPMOST), 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } } // If the window is not transparent anymore, we're not interested anymore if (newAlpha == OPAQUE) { // Restore the old window style RestoreStyle(activeWindowHandle, window.Style); // Let go of the window info this.hijackedWindows.Remove(activeWindowHandle); } e.Handled = true; } }
public InfoForm(WindowInfo windowInfo, SmartSystemMenuSettings settings) { InitializeComponent(); InitializeControls(windowInfo, settings); }
protected TaskMetadata ExecuteRegionCapture(TaskSettings taskSettings) { RegionCaptureMode mode; if (taskSettings.AdvancedSettings.RegionCaptureDisableAnnotation) { mode = RegionCaptureMode.Default; } else { mode = RegionCaptureMode.Annotation; } Bitmap canvas; Screenshot screenshot = TaskHelpers.GetScreenshot(taskSettings); screenshot.CaptureCursor = false; if (taskSettings.CaptureSettings.SurfaceOptions.ActiveMonitorMode) { canvas = screenshot.CaptureActiveMonitor(); } else { canvas = screenshot.CaptureFullscreen(); } CursorData cursorData = null; if (taskSettings.CaptureSettings.ShowCursor) { cursorData = new CursorData(); } using (RegionCaptureForm form = new RegionCaptureForm(mode, taskSettings.CaptureSettingsReference.SurfaceOptions, canvas)) { if (cursorData != null && cursorData.IsVisible) { form.AddCursor(cursorData.Handle, form.PointToClient(cursorData.Position)); } form.ShowDialog(); Bitmap result = form.GetResultImage(); if (result != null) { TaskMetadata metadata = new TaskMetadata(result); if (form.IsImageModified) { AllowAnnotation = false; } if (form.Result == RegionResult.Region) { WindowInfo windowInfo = form.GetWindowInfo(); metadata.UpdateInfo(windowInfo); } lastRegionCaptureType = RegionCaptureType.Default; return(metadata); } } return(null); }
/// <summary> /// ウィンドウを元の場所を維持しながら取り込む /// </summary> public void Show( IntPtr hWnd ) { Attach( hWnd, true ); WindowData = WindowInfoFromHandle( hWnd ); }
public MedicalController(NativeOSWindow mainWindow) { //Create the log. logListener = new LogFileListener(); logListener.openLogFile(MedicalConfig.LogFile); Log.Default.addLogListener(logListener); Log.ImportantInfo("Running from directory {0}", FolderFinder.ExecutableFolder); //Create pluginmanager pluginManager = new PluginManager(MedicalConfig.ConfigFile, services); //Configure the filesystem VirtualFileSystem archive = VirtualFileSystem.Instance; //Setup microcode cache load OgreInterface.MicrocodeCachePath = Path.Combine(FolderFinder.LocalPrivateDataFolder, "ShaderCache.mcc"); OgreInterface.AllowMicrocodeCacheLoad = MedicalConfig.LastShaderVersion == UnifiedMaterialBuilder.Version; OgreInterface.TrackMemoryLeaks = MedicalConfig.TrackMemoryLeaks; MedicalConfig.LastShaderVersion = UnifiedMaterialBuilder.Version; MyGUIInterface.EventLayerKey = EventLayers.Gui; MyGUIInterface.CreateGuiGestures = MedicalConfig.EnableMultitouch && PlatformConfig.TouchType == TouchType.Screen; MyGUIInterface.TrackMemoryLeaks = MedicalConfig.TrackMemoryLeaks; RuntimePlatformInfo.addPath(MedicalConfig.OpenGLESEmulatorPath); //Configure plugins pluginManager.OnConfigureDefaultWindow = delegate(out WindowInfo defaultWindow) { //Setup main window defaultWindow = new WindowInfo(mainWindow, "Primary"); defaultWindow.Fullscreen = MedicalConfig.EngineConfig.Fullscreen; defaultWindow.MonitorIndex = 0; if (MedicalConfig.EngineConfig.Fullscreen) { mainWindow.setSize(MedicalConfig.EngineConfig.HorizontalRes, MedicalConfig.EngineConfig.VerticalRes); mainWindow.ExclusiveFullscreen = true; defaultWindow.Width = MedicalConfig.EngineConfig.HorizontalRes; defaultWindow.Height = MedicalConfig.EngineConfig.VerticalRes; } else { mainWindow.Maximized = true; } mainWindow.show(); }; GuiFrameworkCamerasInterface.CameraTransitionTime = MedicalConfig.CameraTransitionTime; GuiFrameworkCamerasInterface.DefaultCameraButton = MedicalConfig.CameraMouseButton; GuiFrameworkCamerasInterface.MoveCameraEventLayer = EventLayers.Cameras; GuiFrameworkCamerasInterface.SelectWindowEventLayer = EventLayers.AfterGui; GuiFrameworkCamerasInterface.ShortcutEventLayer = EventLayers.Gui; GuiFrameworkCamerasInterface.TouchType = PlatformConfig.TouchType; GuiFrameworkCamerasInterface.PanKey = PlatformConfig.PanKey; GuiFrameworkEditorInterface.ToolsEventLayers = EventLayers.Tools; pluginManager.addPluginAssembly(typeof(OgreInterface).Assembly); pluginManager.addPluginAssembly(typeof(BulletInterface).Assembly); pluginManager.addPluginAssembly(typeof(NativePlatformPlugin).Assembly); pluginManager.addPluginAssembly(typeof(MyGUIInterface).Assembly); pluginManager.addPluginAssembly(typeof(RocketInterface).Assembly); pluginManager.addPluginAssembly(typeof(SoundPluginInterface).Assembly); pluginManager.addPluginAssembly(typeof(BEPUikInterface).Assembly); pluginManager.addPluginAssembly(typeof(SimulationPlugin).Assembly); pluginManager.addPluginAssembly(typeof(GuiFrameworkInterface).Assembly); pluginManager.addPluginAssembly(typeof(RocketWidgetInterface).Assembly); pluginManager.addPluginAssembly(typeof(GuiFrameworkCamerasInterface).Assembly); pluginManager.addPluginAssembly(typeof(GuiFrameworkEditorInterface).Assembly); pluginManager.addPluginAssembly(typeof(GuiFrameworkDebuggingInterface).Assembly); pluginManager.initializePlugins(); performanceMetricTimer = new NativeSystemTimer(); PerformanceMonitor.setupEnabledState(performanceMetricTimer); //Intialize the platform BulletInterface.Instance.ShapeMargin = 0.005f; systemTimer = new NativeSystemTimer(); mainTimer = new NativeUpdateTimer(systemTimer); if (OgreConfig.VSync && MedicalConfig.EngineConfig.FPSCap < 300) { //Use a really high framerate cap if vsync is on since it will cap our //framerate for us. If the user has requested a higher rate use it anyway. mainTimer.FramerateCap = 300; } else { mainTimer.FramerateCap = MedicalConfig.EngineConfig.FPSCap; } inputHandler = new NativeInputHandler(mainWindow, MedicalConfig.EnableMultitouch); eventManager = new EventManager(inputHandler, Enum.GetValues(typeof(EventLayers))); eventUpdate = new EventUpdateListener(eventManager); mainTimer.addUpdateListener(eventUpdate); pluginManager.setPlatformInfo(mainTimer, eventManager); medicalUpdate = new MedicalUpdate(this); mainTimer.addUpdateListener(medicalUpdate); //Initialize controllers medicalScene = new MedicalSceneController(pluginManager); frameClearManager = new FrameClearManager(OgreInterface.Instance.OgrePrimaryWindow.OgreRenderTarget); SoundConfig.initialize(MedicalConfig.ConfigFile); GuiFrameworkInterface.Instance.handleCursors(mainWindow); SoundPluginInterface.Instance.setResourceWindow(mainWindow); TouchMouseGuiForwarder = new TouchMouseGuiForwarder(eventManager, inputHandler, systemTimer, mainWindow, EventLayers.Last); TouchMouseGuiForwarder.ForwardTouchesAsMouse = PlatformConfig.ForwardTouchAsMouse; var myGuiKeyboard = new MyGUIOnscreenKeyboardManager(TouchMouseGuiForwarder); var rocketKeyboard = new RocketWidgetOnscreenKeyboardManager(TouchMouseGuiForwarder); }
static extern IntPtr GetWindowInfo(IntPtr hWnd, ref WindowInfo pwi);
static void AddControl(WindowInfo wi, Painting painting, string nativeName, Mode mode) { wi.AddControl(painting, painting, nativeName, contextId: (int)mode); }
public static extern bool GetWindowInfo(IntPtr hwnd, ref WindowInfo info);
/// <summary> /// ウィンドウを元の場所を維持しながら取り込む /// </summary> public void Show(IntPtr hWnd) { Attach(hWnd, true); WindowData = WindowInfoFromHandle(hWnd); }
private static extern int GetWindowInfo(IntPtr hwnd, ref WindowInfo wi);
internal static extern int GetWindowInfo(IntPtr hwnd, ref WindowInfo wi);
// https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2012/20121101/20121102 //public delegate void LaunchOptions(); public static void Launch <T>(Func <T> Create, Action <WindowInfo <T> > Launching = null) where T : Canvas { var CreateWindow = default(Func <WindowInfo <T> >); var Windows = new List <WindowInfo <T> >(); CreateWindow = delegate { var wi = new WindowInfo <T>(); Windows.Add(wi); wi.Others = Windows.Except(new[] { wi }); wi.CreateWindow = delegate { var ci = CreateWindow(); ci.Window.Owner = wi.Window; if (Launching != null) { Launching(ci); } ci.Window.Show(); return(ci); }; var CreateContent = Create; var ActualSize = new Canvas(); var ActualSize2 = new Canvas(); var c = CreateContent(); if (double.IsNaN(c.Width)) { } else { ActualSize.Width = c.Width; ActualSize.Height = c.Height; } c.AttachTo(ActualSize); // hack // Could not load file or assembly 'c:\/util\/jsc\/bin\/ScriptCoreLib.Ultra.Components.Volatile.dll' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) //var JSCBrandedWindow = Assembly.Load(@"c:\util\jsc\bin\ScriptCoreLib.Ultra.Components.Volatile.dll").GetType("ScriptCoreLib.Avalon.Desktop.JSCBrandedWindow"); //var branded = (Window)Activator.CreateInstance(JSCBrandedWindow); var w = ActualSize.ToWindow(); if (double.IsNaN(c.Width)) { w.SizeToContent = SizeToContent.Manual; w.Width = ScriptApplicationEntryPointAttribute.DefaultWidth; w.Height = ScriptApplicationEntryPointAttribute.DefaultHeight; } else { ActualSize.Width = c.Width; ActualSize.Height = c.Height; } ActualSize2.SizeChanged += delegate { c.SizeTo(ActualSize2.ActualWidth, ActualSize2.ActualHeight); }; ActualSize.SizeChanged += delegate { c.SizeTo(ActualSize.ActualWidth, ActualSize.ActualHeight); }; w.SourceInitialized += delegate { if (w.SizeToContent != SizeToContent.Manual) { w.Content = null; w.SizeToContent = SizeToContent.Manual; c.Orphanize().AttachTo(ActualSize2); ActualSize2.AttachTo(w); return; } }; wi.Content = c; wi.Window = w; w.Background = Brushes.White; w.Title += " | F2 - Spawn, F11 - Fullscreen"; var ExitFullscreen = default(Action); #region ToFullscreen Action ToFullscreen = () => { if (ExitFullscreen != null) { return; } var x = new { w.Topmost, w.WindowState, w.WindowStyle }; ExitFullscreen = () => { ExitFullscreen = null; w.WindowStyle = x.WindowStyle; w.WindowState = x.WindowState; w.Topmost = x.Topmost; }; w.Topmost = true; w.WindowStyle = System.Windows.WindowStyle.None; w.WindowState = System.Windows.WindowState.Normal; w.WindowState = System.Windows.WindowState.Maximized; }; #endregion #region Deactivated w.Deactivated += delegate { if (ExitFullscreen != null) { ExitFullscreen(); return; } }; #endregion #region PreviewKeyUp w.PreviewKeyUp += (s, e) => { if (e.Key == Key.Escape) { if (ExitFullscreen != null) { ExitFullscreen(); e.Handled = true; return; } } if (e.Key == Key.F2) { wi.CreateWindow(); e.Handled = true; return; } if (e.Key == Key.F11) { if (ExitFullscreen != null) { ExitFullscreen(); e.Handled = true; return; } ToFullscreen(); e.Handled = true; return; } }; #endregion return(wi); }; var t = new Thread( delegate() { var wi = CreateWindow(); if (Launching != null) { Launching(wi); } wi.Window.ShowDialog(); } ) { ApartmentState = ApartmentState.STA }; t.Start(); t.Join(); }
static void PlaceWindowOnScreen(IntPtr hWnd) { WindowInfo wi = new WindowInfo(); GetWindowInfo(hWnd, ref wi); int maxVisibleArea = 0; Rectangle resultWindowRect = new Rectangle(); bool found = false; foreach(var s in Screen.AllScreens) { int visibleArea = GetWindowVisibleArea(wi, s); if(visibleArea > maxVisibleArea) { maxVisibleArea = visibleArea; resultWindowRect = GetVisibleRectangle(wi, s); found = true; } } if(found) MoveWindow(hWnd, resultWindowRect.X, resultWindowRect.Y, resultWindowRect.Width, resultWindowRect.Height, true); }
/// <summary> /// Initializes a new instance of the <see cref="WindowManagerEventArgs"/> class. /// </summary> /// <param name="window">The info of the window related to this event.</param> internal WindowManagerEventArgs(WindowInfo window) { Window = window; }
public WindowBorderOnScreenFlags(WindowInfo wi, Screen s) { leftBorderOnScreen = (wi.rcWindow.left >= s.WorkingArea.Left) && (wi.rcWindow.left < s.WorkingArea.Right); rightBorderOnScreen = (wi.rcWindow.right > s.WorkingArea.Left) && (wi.rcWindow.right <= s.WorkingArea.Right); topBorderOnScreen = (wi.rcWindow.top >= s.WorkingArea.Top) && (wi.rcWindow.top < s.WorkingArea.Bottom); bottomBorderOnScreen = (wi.rcWindow.bottom > s.WorkingArea.Top) && (wi.rcWindow.bottom <= s.WorkingArea.Bottom); }
public Window(WindowInfo windowInfo) { WindowInfo = windowInfo; }
private void PlatformSetup() { #if DESKTOPGL || ANGLE var windowInfo = new WindowInfo(SdlGameWindow.Instance.Handle); if (Context == null || Context.IsDisposed) { Context = GL.CreateContext(windowInfo); } Context.MakeCurrent(windowInfo); Context.SwapInterval = PresentationParameters.PresentationInterval.GetSwapInterval(); /*if (Threading.BackgroundContext == null) * { * Threading.BackgroundContext = GL.CreateContext(windowInfo); * Threading.WindowInfo = windowInfo; * Threading.BackgroundContext.MakeCurrent(null); * }*/ Context.MakeCurrent(windowInfo); /*GraphicsMode mode = GraphicsMode.Default; * var wnd = OpenTK.Platform.Utilities.CreateSdl2WindowInfo(Game.Instance.Window.Handle); * #if GLES * // Create an OpenGL ES 2.0 context * var flags = GraphicsContextFlags.Embedded; * int major = 2; * int minor = 0; #else * // Create an OpenGL compatibility context * var flags = GraphicsContextFlags.Default; * int major = 1; * int minor = 0; #endif * * if (Context == null || Context.IsDisposed) * { * var color = PresentationParameters.BackBufferFormat.GetColorFormat(); * var depth = * PresentationParameters.DepthStencilFormat == DepthFormat.None ? 0 : * PresentationParameters.DepthStencilFormat == DepthFormat.Depth16 ? 16 : * 24; * var stencil = * PresentationParameters.DepthStencilFormat == DepthFormat.Depth24Stencil8 ? 8 : * 0; * * var samples = 0; * if (Game.Instance.graphicsDeviceManager.PreferMultiSampling) * { * // Use a default of 4x samples if PreferMultiSampling is enabled * // without explicitly setting the desired MultiSampleCount. * if (PresentationParameters.MultiSampleCount == 0) * { * PresentationParameters.MultiSampleCount = 4; * } * * samples = PresentationParameters.MultiSampleCount; * } * * mode = new GraphicsMode(color, depth, stencil, samples); * try * { * Context = new GraphicsContext(mode, wnd, major, minor, flags); * } * catch (Exception e) * { * Game.Instance.Log("Failed to create OpenGL context, retrying. Error: " + * e.ToString()); * major = 1; * minor = 0; * flags = GraphicsContextFlags.Default; * Context = new GraphicsContext(mode, wnd, major, minor, flags); * } * } * Context.MakeCurrent(wnd); * (Context as IGraphicsContextInternal).LoadAll(); * Context.SwapInterval = PresentationParameters.PresentationInterval.GetSwapInterval(); * * // Provide the graphics context for background loading * // Note: this context should use the same GraphicsMode, * // major, minor version and flags parameters as the main * // context. Otherwise, context sharing will very likely fail. * if (Threading.BackgroundContext == null) * { * Threading.BackgroundContext = new GraphicsContext(mode, wnd, major, minor, flags); * Threading.WindowInfo = wnd; * Threading.BackgroundContext.MakeCurrent(null); * } * Context.MakeCurrent(wnd);*/ #endif MaxTextureSlots = 16; GL.GetInteger(GetPName.MaxTextureImageUnits, out MaxTextureSlots); GraphicsExtensions.CheckGLError(); GL.GetInteger(GetPName.MaxVertexAttribs, out MaxVertexAttributes); GraphicsExtensions.CheckGLError(); GL.GetInteger(GetPName.MaxTextureSize, out _maxTextureSize); GraphicsExtensions.CheckGLError(); SpriteBatch.NeedsHalfPixelOffset = true; // try getting the context version // GL_MAJOR_VERSION and GL_MINOR_VERSION are GL 3.0+ only, so we need to rely on the GL_VERSION string // for non GLES this string always starts with the version number in the "major.minor" format, but can be followed by // multiple vendor specific characters // For GLES this string is formatted as: OpenGL<space>ES<space><version number><space><vendor-specific information> #if GLES try { string version = GL.GetString(StringName.Version); string[] versionSplit = version.Split(' '); if (versionSplit.Length > 2 && versionSplit[0].Equals("OpenGL") && versionSplit[1].Equals("ES")) { glMajorVersion = Convert.ToInt32(versionSplit[2].Substring(0, 1)); glMinorVersion = Convert.ToInt32(versionSplit[2].Substring(2, 1)); } else { glMajorVersion = 1; glMinorVersion = 1; } } catch (FormatException) { //if it fails we default to 1.1 context glMajorVersion = 1; glMinorVersion = 1; } #else try { string version = GL.GetString(StringName.Version); glMajorVersion = Convert.ToInt32(version.Substring(0, 1)); glMinorVersion = Convert.ToInt32(version.Substring(2, 1)); } catch (FormatException) { // if it fails, we assume to be on a 1.1 context glMajorVersion = 1; glMinorVersion = 1; } #endif #if !GLES // Initialize draw buffer attachment array int maxDrawBuffers; GL.GetInteger(GetPName.MaxDrawBuffers, out maxDrawBuffers); GraphicsExtensions.CheckGLError(); _drawBuffers = new DrawBuffersEnum[maxDrawBuffers]; for (int i = 0; i < maxDrawBuffers; i++) { _drawBuffers[i] = (DrawBuffersEnum)(FramebufferAttachment.ColorAttachment0Ext + i); } #endif _extensions = GetGLExtensions(); }
static int GetWindowVisibleArea(WindowInfo wi, Screen s) { WindowBorderOnScreenFlags flags = new WindowBorderOnScreenFlags(wi, s); int visibleWidth = 0, visibleHeight = 0; if(flags.leftBorderOnScreen) visibleWidth = flags.rightBorderOnScreen ? wi.rcWindow.right - wi.rcWindow.left : s.WorkingArea.Right - wi.rcWindow.left; else if(flags.rightBorderOnScreen) visibleWidth = wi.rcWindow.right - s.WorkingArea.Left; if(flags.topBorderOnScreen) visibleHeight = flags.bottomBorderOnScreen ? wi.rcWindow.bottom - wi.rcWindow.top : s.WorkingArea.Bottom - wi.rcWindow.top; else if(flags.bottomBorderOnScreen) visibleHeight = wi.rcWindow.bottom - s.WorkingArea.Top; return visibleWidth * visibleHeight; }
public void GetGumpCode( ) { WindowInfo info = new WindowInfo(); try { info = skin.WindowInfo["SkillWindow"]; } catch { return; } this.X = info.X; this.Y = info.Y; this.AddButton(170, 0, 2093, 2093, -100, GumpButtonType.Reply, 0); this.AddBackground(0, 15, info.W, info.H, info.bgID); this.AddImage(145, 30, 2100); this.AddImage(22, 355, 2102); this.AddImage(60, 54, 2091); this.AddImage(60, 333, 2091); Mobile m = Mobile; Skills s = m.Skills; this.AddLabel(270, 354, skin.BlueTextHue, "" + (checkdouble(s.Total / 10) ? " " + (s.Total / 10) + ".0" : " " + (s.Total / 10))); GumpList l = new GumpList(this, "details", skin); l.columns = 5; l.ShowDividers = false; l.ShowBackground = false; l.columnWidths[0] = 15; l.columnWidths[1] = 200; l.numperpage = 14; l.X = 20; l.Y = 51; ButtonInfo ecg = skin.ButtonInfo["ExpandContractGroup"]; GumpListEntry miscentry = new GumpListEntry(0, 0, l, info.W - 10, 20); miscentry.AddColumn(new GumpButton(0, 0, !showing.Contains(1) ? ecg.up : ecg.down, !showing.Contains(1) ? ecg.up : ecg.down, 1, GumpButtonType.Reply, 0)); miscentry.AddColumn("<basefont size=5 face = 1 color= #330066> Miscellaneous</basefont>"); GumpListEntry combentry = new GumpListEntry(0, 0, l, info.W - 10, 20); combentry.AddColumn(new GumpButton(0, 0, !showing.Contains(2) ? ecg.up : ecg.down, !showing.Contains(2) ? ecg.up : ecg.down, 2, GumpButtonType.Reply, 0)); combentry.AddColumn("<basefont size=5 face = 1 color= #330066> Combat Ratings</basefont>"); GumpListEntry actientry = new GumpListEntry(0, 0, l, info.W - 10, 20); actientry.AddColumn(new GumpButton(0, 0, !showing.Contains(3) ? ecg.up : ecg.down, !showing.Contains(3) ? ecg.up : ecg.down, 3, GumpButtonType.Reply, 0)); actientry.AddColumn("<basefont size=5 face = 1 color= #330066> Actions</basefont>"); GumpListEntry loreentry = new GumpListEntry(0, 0, l, info.W - 10, 20); loreentry.AddColumn(new GumpButton(0, 0, !showing.Contains(4) ? ecg.up : ecg.down, !showing.Contains(4) ? ecg.up : ecg.down, 4, GumpButtonType.Reply, 0)); loreentry.AddColumn("<basefont size=5 face = 1 color= #330066> Lore & Knowledge</basefont>"); GumpListEntry customentry = new GumpListEntry(0, 0, l, info.W - 10, 20); customentry.AddColumn(new GumpButton(0, 0, !showing.Contains(5) ? ecg.up : ecg.down, !showing.Contains(5) ? ecg.up : ecg.down, 5, GumpButtonType.Reply, 0)); customentry.AddColumn("<basefont size=5 face = 1 color= #330066> Custom Skills</basefont>"); ButtonInfo select = skin.ButtonInfo["UseButton"]; IEnumerator ie = null; int i = 1; for (int k = 0; k < s.Length; k++) { if (ParallelSkills.actisearch.Contains(s[k].Name)) { actiinfos.Add(s[k]); } else if (ParallelSkills.combsearch.Contains(s[k].Name)) { combinfos.Add(s[k]); } else if (ParallelSkills.miscsearch.Contains(s[k].Name)) { miscinfos.Add(s[k]); } else if (ParallelSkills.loresearch.Contains(s[k].Name)) { loreinfos.Add(s[k]); } else { custom.Add(s[k]); } } actiinfos.Sort(CompareSkillNames); combinfos.Sort(CompareSkillNames); miscinfos.Sort(CompareSkillNames); loreinfos.Sort(CompareSkillNames); custom.Sort(CompareSkillNames); l.Add(miscentry); if (showing.Contains(1)) { ie = miscinfos.GetEnumerator(); while (ie.MoveNext()) { SkillSettings.DoTell2("Misc i: " + i + " Skill: " + ((Skill)ie.Current).ToString()); addEntry(l, (Skill)ie.Current, i, 1); i++; } } else { i += miscinfos.Count; } l.Add(combentry); if (showing.Contains(2)) { //i = 1; ie = combinfos.GetEnumerator(); while (ie.MoveNext()) { SkillSettings.DoTell2("Co i: " + i + " Skill: " + ((Skill)ie.Current).ToString()); addEntry(l, (Skill)ie.Current, i, 2); i++; } } else { i += combinfos.Count; } l.Add(actientry); if (showing.Contains(3)) { //i = 1; ie = actiinfos.GetEnumerator(); while (ie.MoveNext()) { SkillSettings.DoTell2("A i: " + i + " Skill: " + ((Skill)ie.Current).ToString()); addEntry(l, (Skill)ie.Current, i, 3); i++; } } else { i += actiinfos.Count; } l.Add(loreentry); if (showing.Contains(4)) { //i = 1; ie = loreinfos.GetEnumerator(); while (ie.MoveNext()) { SkillSettings.DoTell2("L i: " + i + " Skill: " + ((Skill)ie.Current).ToString()); addEntry(l, (Skill)ie.Current, i, 4); i++; } } else { i += loreinfos.Count; } l.Add(customentry); if (showing.Contains(5)) { //i = 1; ie = custom.GetEnumerator(); while (ie.MoveNext()) { SkillSettings.DoTell2("Cu i: " + i + " Skill: " + ((Skill)ie.Current).ToString()); addEntry(l, (Skill)ie.Current, i, 5); i++; } } l.CommitList(); }
static Bitmap PrintWindow(IntPtr hwnd, WindowInfo wi, string browser) { Bitmap windowBitmap = new Bitmap(wi.rcWindow.right - wi.rcWindow.left, wi.rcWindow.bottom - wi.rcWindow.top, System.Drawing.Imaging.PixelFormat.Format32bppRgb); Graphics graphicsWindow = Graphics.FromImage(windowBitmap); IntPtr hdc = graphicsWindow.GetHdc(); PrintWindow(hwnd, hdc, 0); if(browser == "ie") // HACK: for IE PrintWindow(hwnd, hdc, 0); graphicsWindow.ReleaseHdc(hdc); graphicsWindow.Flush(); return windowBitmap; }
private void BgwScriptDncDoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { const double scanInterval = 0.3; while (botRunning && !bgw_script_dnc.CancellationPending) { //TargetInfo.SetTarget(0); if ((PlayerInfo.Status == 2 || PlayerInfo.Status == 3) && File.Exists(Application.StartupPath + @"\dead.wav")) { using (SoundPlayer player = new SoundPlayer(Application.StartupPath + @"\dead.wav")) { player.PlaySync(); player.Dispose(); } } if (checkZone.Checked && startzone != api.Player.ZoneId) { ToolStopClick(null, null); } if (DeathWarp.Checked && (PlayerInfo.Status == 2 || PlayerInfo.Status == 3)) { PlayerDead(); } if (isCasting) { continue; } if (followplayer.Checked && PlayerInfo.Status == 0) { FollowTarget(); } if ((assist.Checked || partyAssist.Checked) && PlayerInfo.Status == 0) { Assist(); } if (aggro.Checked && PlayerInfo.Status == 0 && !isPulled) { DetectAggro(); } if (PlayerInfo.Status == 0 && !isPulled && SelectedTargets.Items.Count != 0) { FindTarget(); } while (PlayerInfo.Status == 1 && botRunning && TargetInfo.ID > 0) { isPulled = true; if (naviMove) { naviMove = false; } if (ignoreTarget.Count > 0) { ignoreTarget.Clear(); } #region Check Target Distance if (mobdist.Checked) { if (TargetInfo.Distance >= (float)KeepTargetRange.Value && TargetInfo.HPP > 1) { isMoving = true; while (TargetMoving() && PlayerInfo.Status == 1 && botRunning) { Thread.Sleep(TimeSpan.FromSeconds(0.1)); } while (TargetInfo.Distance >= (float)KeepTargetRange.Value && TargetInfo.HPP > 1 && PlayerInfo.Status == 1 && botRunning) { api.AutoFollow.SetAutoFollowCoords(TargetInfo.X - PlayerInfo.X, TargetInfo.Y - PlayerInfo.Y, TargetInfo.Z - PlayerInfo.Z); api.AutoFollow.IsAutoFollowing = true; Thread.Sleep(TimeSpan.FromSeconds(0.1)); if (TargetInfo.ID == 0 || TargetInfo.ID == PlayerInfo.ServerID) { break; } if (mobStuckWatch.Checked && isStuck(true)) { int count = 0; float dir = -45; while (isStuck(true)) { if (TargetInfo.ID == 0 || TargetInfo.ID == PlayerInfo.ServerID) { break; } api.Entity.GetLocalPlayer().H = PlayerInfo.H + (float)((Math.PI / 180) * dir); WindowInfo.KeyDown(API.Keys.NUMPAD8); Thread.Sleep(TimeSpan.FromSeconds(2)); WindowInfo.KeyUp(API.Keys.NUMPAD8); count++; if (count == 4) { dir = (dir == -45 ? 45 : -45); count = 0; } } WindowInfo.KeyUp(API.Keys.NUMPAD8); } } api.AutoFollow.IsAutoFollowing = false; isMoving = false; } if (TargetInfo.Distance < 2 && TargetInfo.HPP > 1 && PlayerInfo.Status == 1 && TargetInfo.ID > 0) { while (TargetInfo.Distance < 2 && TargetInfo.HPP > 1 && PlayerInfo.Status == 1 && TargetInfo.ID > 0) { WindowInfo.KeyDown(API.Keys.NUMPAD2); Thread.Sleep(TimeSpan.FromSeconds(0.1)); } WindowInfo.KeyUp(API.Keys.NUMPAD2); } } #endregion WindowInfo.KeyUp(API.Keys.NUMPAD8); WindowInfo.KeyUp(API.Keys.NUMPAD2); if (!TargetInfo.IsFacingTarget(PlayerInfo.X, PlayerInfo.Z, PlayerInfo.H, TargetInfo.X, TargetInfo.Z) && facetarget.Checked && TargetInfo.HPP > 1) { TargetInfo.FaceTarget(TargetInfo.X, TargetInfo.Z); } ninjaShadows(); #region Check Hate Control if (tank.Checked && selectedHateControl.Text != "" && PlayerInfo.Status == 1 && TargetInfo.ID > 0) { if (selectedHateControl.Text == @"Animated Flourish" && PlayerInfo.GetFinishingMoves() > 0 && Recast.GetAbilityRecast(221) == 0) { if (TargetInfo.HPP >= numericUpDown7.Value && TargetInfo.HPP <= numericUpDown6.Value && PlayerInfo.Status == 1 && TargetInfo.ID > 0) { api.ThirdParty.SendString("/ja \"Animated Flourish\" <t>"); Thread.Sleep(TimeSpan.FromSeconds(1.0)); } } if (selectedHateControl.Text == @"Provoke" && Recast.GetAbilityRecast(5) == 0) { if (TargetInfo.HPP >= numericUpDown7.Value && TargetInfo.HPP <= numericUpDown6.Value && PlayerInfo.Status == 1 && TargetInfo.ID > 0) { api.ThirdParty.SendString("/ja \"Provoke\" <t>"); Thread.Sleep(TimeSpan.FromSeconds(1.0)); } } if (selectedHateControl.Text == @"Flash" && PlayerInfo.MPP >= 25 && Recast.GetAbilityRecast(112) == 0) { if (TargetInfo.HPP >= numericUpDown7.Value && TargetInfo.HPP <= numericUpDown6.Value && PlayerInfo.Status == 1 && TargetInfo.ID > 0) { api.ThirdParty.SendString("/ma \"Flash\" <t>"); Casting(); } } } #endregion HealingWaltz(); if (usecurev.Checked || usecureiv.Checked || usecureiii.Checked || usecureii.Checked || usecure.Checked) { CuringWaltzSelf(); } if (ptusecurev.Checked || ptusecureiv.Checked || ptusecureiii.Checked || ptusecureii.Checked || ptusecure.Checked) { CuringWaltzParty(); } if ((usedrain.Checked || usedrainii.Checked || usedrainiii.Checked || useaspir.Checked || useaspirii.Checked || usehaste.Checked) && !noSamba.Checked) { Sambas(); } if ((usequickstep.Checked || useboxstep.Checked || usestutterstep.Checked || usefeatherstep.Checked) && !NoSteps.Checked) { Steps(); } #region Check AutoRange Attack if (autoRangeAttack.Checked && TargetInfo.ID > 0) { api.ThirdParty.SendString(textBox7.Text); var delay = DateTime.Now.AddSeconds((double)autoRangeDelay.Value); while (DateTime.Now < delay) { if (PlayerInfo.Status == 0) { break; } TargetInfo.FaceTarget(TargetInfo.X, TargetInfo.Z); Thread.Sleep(TimeSpan.FromSeconds(1.0)); } } #endregion #region Check Use Food if (usefood.Checked) { var name = foodName.Text; if (!PlayerInfo.HasBuff(251) && name != "" && Inventory.ItemQuantityByName(name) > 0) { api.ThirdParty.SendString("/item \"" + name + "\" <me>"); Thread.Sleep(TimeSpan.FromSeconds(10.0)); } } #endregion PlayerJA(); PlayerWS(); PlayerMA(); if (PlayerInfo.GetFinishingMoves() > 0) { if (userevfloValue.Value > 0 || usebldfloValue.Value > 0 || usewldfloValue.Value > 0 || useclmfloValue.Value > 0 || usestkfloValue.Value > 0 || useterfloValue.Value > 0) { if (TargetInfo.ID > 0) { UseFlourish(); } } } Thread.Sleep(TimeSpan.FromSeconds(0.1)); } #region check: scan delay & idle if (usenav.Checked && api.AutoFollow.IsAutoFollowing && !naviMove) { api.AutoFollow.IsAutoFollowing = false; } if (PlayerInfo.Status == 0 && PlayerInfo.Status != 0 && TargetInfo.HPP == 0) { SetTarget(0); } if (ScanDelay.Checked && !naviMove) { Thread.Sleep(TimeSpan.FromSeconds((double)numericUpDown38.Value)); } else if (!ScanDelay.Checked) { Thread.Sleep(TimeSpan.FromSeconds(scanInterval)); } if (IdleLocation.Checked && PlayerInfo.Status == 0 && (TargetInfo.ID == 0 || TargetInfo.ID == PlayerInfo.TargetID)) { ReturnIdleLocation(); } if (PlayerInfo.Status == 0 && isPulled) { isPulled = false; if (aggro.Checked && PlayerInfo.Status == 0) { DetectAggro(); } if (PlayerInfo.Status == 0 && ((HealHP.Checked && PlayerInfo.HPP <= healHPcount.Value) || (HealMP.Checked && PlayerInfo.MPP <= healMPcount.Value) || (healforAutomatonHP.Checked && PetInfo.HPP <= healforAutomatonHPset.Value) || (healforAutomatonMP.Checked && PetInfo.MPP <= healforAutomatonMPset.Value))) { Thread.Sleep(TimeSpan.FromSeconds(1.0)); if ((PlayerInfo.MainJob == 15 || PlayerInfo.SubJob == 15) && PetInfo.ID > 0) { if (SMNPetNames.Contains(PetInfo.Name)) { api.ThirdParty.SendString("/pet \"Release\" <me>"); Thread.Sleep(TimeSpan.FromSeconds(1.0)); } } api.ThirdParty.SendString("/heal on"); Thread.Sleep(TimeSpan.FromSeconds(1.0)); if (textBox6.Text != "") { PreHealMain = api.Resources.GetItem(api.Player.Main).Name[0]; PreHealSub = api.Resources.GetItem(api.Player.Sub).Name[0]; api.ThirdParty.SendString($"/equip Main \"{textBox6.Text}\""); } SetTarget(0); } if (PlayerInfo.Status == 0 && !isPulled) { FindTarget(); } } if ((TargetInfo.ID == 0 || TargetInfo.ID == PlayerInfo.TargetID) && PlayerInfo.Status == 0 && !naviMove) { useTrust(); if (Recast.GetAbilityRecast(218) == 0 && UseJigs.Checked) { if (SpectralJig.Checked && !PlayerInfo.HasBuff(69)) { api.ThirdParty.SendString("/ja \"Spectral Jig\" <me>"); } else if (ChocoboJig.Checked) { api.ThirdParty.SendString("/ja \"Chocobo Jig\" <me>"); } else if (ChocoboJigII.Checked) { api.ThirdParty.SendString("/ja \"Chocobo Jig II\" <me>"); } } SetTarget(0); } if (usenav.Checked && !naviMove && PlayerInfo.Status == 0) { if (TargetInfo.ID > 0) { SetTarget(0); } naviMove = true; } if (PlayerInfo.Status == 33) { var healdone = false; while (PlayerInfo.Status == 33 && (HealHP.Checked || HealMP.Checked || healforAutomatonHP.Checked || healforAutomatonMP.Checked)) { Thread.Sleep(TimeSpan.FromSeconds(0.1)); if (fullheal.Checked) { if ((PlayerInfo.MainJob == 9 || PlayerInfo.SubJob == 9) && PetInfo.Name != null) { if (PlayerInfo.HPP == 100 && PlayerInfo.MPP == 100 && PetInfo.HPP == 100 && PetInfo.MPP == 100) { healdone = true; } } else if (PlayerInfo.HPP == 100 && PlayerInfo.MPP == 100) { healdone = true; } } else if ((HealHP.Checked? PlayerInfo.HPP == 100 : true) && (HealMP.Checked? PlayerInfo.MPP == 100 : true) && (healforAutomatonHP.Checked? PetInfo.HPP == 100 : true) && (healforAutomatonMP.Checked? PetInfo.MPP == 100 : true)) { healdone = true; } if (healdone) { if (textBox6.Text != "" && healdone) { api.ThirdParty.SendString($"/equip Main \"{PreHealMain}\""); Thread.Sleep(TimeSpan.FromSeconds(1.0)); api.ThirdParty.SendString($"/equip Sub \"{PreHealSub}\""); } api.ThirdParty.SendString("/heal off"); Thread.Sleep(TimeSpan.FromSeconds(1.0)); } } } #endregion } WindowInfo.KeyUp(API.Keys.NUMPAD8); WindowInfo.KeyUp(API.Keys.NUMPAD2); api.AutoFollow.IsAutoFollowing = false; isMoving = false; }
private void BgwScriptPetDoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { while (botRunning && !bgw_script_pet.CancellationPending) { if (PetInfo.Name != null) { pInfo(); } #region pet: BST if (PlayerInfo.MainJob == 9 || PlayerInfo.SubJob == 9) { if (juguse.Checked && PetInfo.ID == 0 && jugpet.Text != "" && Inventory.ItemQuantityByName(jugpet.Text) > 0) { #region Ammo/Ranged Slot var rangedSlot = InventoryItems.Items.FirstOrDefault(x => x.Key == api.Inventory.GetEquippedItem(2).Id.ToString()).Value; var ammoSlot = InventoryItems.Items.FirstOrDefault(x => x.Key == api.Inventory.GetEquippedItem(3).Id.ToString()).Value; #endregion var call = ""; var call1 = api.Resources.GetAbility(899); var call2 = api.Resources.GetAbility(597); if (Recast.GetAbilityRecast(call1.TimerID) == 0) { call = call1.Name[0]; } else if (Recast.GetAbilityRecast(call2.TimerID) == 0 && Recast.GetAbilityRecast(call1.TimerID) != 0) { call = call2.Name[0]; } if (call != "") { WindowInfo.SendText($"/equip Ammo \"{jugpet.Text}\""); Thread.Sleep(TimeSpan.FromSeconds(1.0)); WindowInfo.SendText($"/ja \"{call}\" <me>"); Thread.Sleep(TimeSpan.FromSeconds(2.0)); } #region Re-Equip Ammo/Ranged if (ammoSlot != null && ammoSlot != jugpet.Text) { WindowInfo.SendText("/equip Ammo \"" + ammoSlot + "\""); Thread.Sleep(TimeSpan.FromSeconds(1.0)); } else if (rangedSlot != null) { WindowInfo.SendText("/equip Range \"" + rangedSlot + "\""); Thread.Sleep(TimeSpan.FromSeconds(1.0)); } #endregion if (TargetInfo.ID > 0 && TargetInfo.ID != PlayerInfo.ServerID) { LockOn(); } } if (PetInfo.ID > 0 && autoengage.Checked && PlayerInfo.Status == 1 && PetInfo.Status == 0 && TargetInfo.ID > 0) { WindowInfo.SendText("/ja \"Fight\" <t>"); Thread.Sleep(TimeSpan.FromSeconds(4.0)); } if (petfooduse.Checked && Inventory.ItemQuantityByName(usedpetfood.Text) > 0 && PetInfo.ID > 0 && usedpetfood.Text != "" && PetInfo.HPP < pethppfood.Value && Recast.GetAbilityRecast(103) == 0) { #region Ammo/Ranged Slot var rangedSlot = InventoryItems.Items.FirstOrDefault(x => x.Key == api.Inventory.GetEquippedItem(2).Id.ToString()).Value; var ammoSlot = InventoryItems.Items.FirstOrDefault(x => x.Key == api.Inventory.GetEquippedItem(3).Id.ToString()).Value; #endregion WindowInfo.SendText("/equip Ammo \"" + usedpetfood.Text + "\""); Thread.Sleep(TimeSpan.FromSeconds(2.0)); WindowInfo.SendText("/ja \"Reward\" <me>"); Thread.Sleep(TimeSpan.FromSeconds(2.0)); #region Re-Equip Ammo/Ranged if (ammoSlot != null && ammoSlot != usedpetfood.Text) { WindowInfo.SendText("/equip Ammo \"" + ammoSlot + "\""); Thread.Sleep(TimeSpan.FromSeconds(2.0)); } else if (rangedSlot != null) { WindowInfo.SendText("/equip Range \"" + rangedSlot + "\""); Thread.Sleep(TimeSpan.FromSeconds(2.0)); } #endregion } if (PetInfo.ID > 0 && PetJA.Items.Count > 0 && PetInfo.Status == 1 && TargetInfo.ID > 0) { PetReadyJA(); } } #endregion #region pet: DRG if (PlayerInfo.MainJob == 14 || PlayerInfo.SubJob == 14) { if (PetInfo.ID == 0 && CallWyvern.Checked && Recast.GetAbilityRecast(163) == 0) { WindowInfo.SendText("/ja \"Call Wyvern\" <me>"); Thread.Sleep(TimeSpan.FromSeconds(2.0)); } if (PetInfo.ID > 0 && WyvernJA.Items.Count > 0 && PlayerInfo.Status == 1 && !string.IsNullOrEmpty(TargetInfo.Name)) { WyvernUseJA(); } } #endregion #region pet: SMN if (PlayerInfo.MainJob == 15 || PlayerInfo.SubJob == 15) { if (autoengageAvatar.Checked && PetInfo.ID > 0 && PlayerInfo.Status == 1 && PetInfo.Status == 0 && TargetInfo.ID > 0) { api.ThirdParty.SendString("/pet \"Assault\" <t>"); Thread.Sleep(TimeSpan.FromSeconds(1.0)); } if (SMNSelect.SelectedItem.ToString() != "") { SMNUseJA(); } } #endregion #region pet: PUP if (PlayerInfo.MainJob == 18 || PlayerInfo.SubJob == 18) { PUPUseJA(); } #endregion Thread.Sleep(TimeSpan.FromSeconds(0.1)); } }
private void BgwScriptNavDoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { int count = 0; float dir = -45; while (botRunning && !bgw_script_nav.CancellationPending) { Thread.Sleep(TimeSpan.FromSeconds(0.1)); if (isCasting) { continue; } if (Linear.Checked) { runReverse.Enabled = false; } else { runReverse.Enabled = true; } if (naviMove && usenav.Checked && selectedNavi.Text != "" && PlayerInfo.Status == 0 && (!PlayerInfo.HasBuff(10) || !PlayerInfo.HasBuff(11) || !PlayerInfo.HasBuff(0))) { if (checkZone.Checked && startzone != api.Player.ZoneId) { ToolStopClick(null, null); } var nextWaypoint = FindNextWaypoint(); if (firstPersonView.Checked || navPathfirst[nextWaypoint]) { if (api.Player.ViewMode != 1) { api.Player.ViewMode = 1; } api.AutoFollow.IsAutoFollowing = false; api.Entity.GetLocalPlayer().H = (float)((Math.PI / 180) * (PlayerInfo.GetAngleFrom(navPathX[nextWaypoint], navPathZ[nextWaypoint]) - 180)); } else if (api.Player.ViewMode == 1) { api.Player.ViewMode = 0; } api.AutoFollow.SetAutoFollowCoords((float)navPathX[nextWaypoint] - PlayerInfo.X, navPathY[nextWaypoint] == 0 ? 0 : (float)navPathY[nextWaypoint] - PlayerInfo.Y, (float)navPathZ[nextWaypoint] - PlayerInfo.Z); if (navPathpause[nextWaypoint].Contains("Pause")) { api.AutoFollow.IsAutoFollowing = false; var items = navPathpause[nextWaypoint].Split(';'); Thread.Sleep(TimeSpan.FromSeconds(double.Parse(items[1]))); } //if (navPathpause[closestWayPoint] > 0 && !paused) //{ // api.AutoFollow.IsAutoFollowing = false; // beenpaused = true; // Thread.Sleep(TimeSpan.FromSeconds(navPathpause[closestWayPoint])); // api.AutoFollow.IsAutoFollowing = true; //} //else if (navPathpause[closestWayPoint] == 0) // beenpaused = false; //if (navPathForceHeal[closestWayPoint] && (PlayerInfo.HPP < 100 || PlayerInfo.MPP < 100)) //{ // api.AutoFollow.IsAutoFollowing = false; // naviMove = false; // api.ThirdParty.SendString("/heal on"); // continue; //} if (navPathdoor[nextWaypoint].Contains("Door")) { CheckDoor(nextWaypoint); } //if (navPathdoor[closestWayPoint] > 0) //{ // CheckDoor(closestWayPoint); //} else { lastcommandtarget = ""; } api.AutoFollow.IsAutoFollowing = true; } else if (usenav.Checked && api.AutoFollow.IsAutoFollowing && !isMoving) { api.AutoFollow.IsAutoFollowing = false; } Thread.Sleep(TimeSpan.FromSeconds(1.0)); if (navStuckWatch.Checked && naviMove && usenav.Checked && selectedNavi.Text != "" && api.AutoFollow.IsAutoFollowing && isStuck()) { api.AutoFollow.IsAutoFollowing = false; api.Entity.GetLocalPlayer().H = PlayerInfo.H + (float)((Math.PI / 180) * dir); WindowInfo.KeyDown(API.Keys.NUMPAD8); Thread.Sleep(TimeSpan.FromSeconds(2)); WindowInfo.KeyUp(API.Keys.NUMPAD8); count++; if (count == 4) { dir = (dir == -45 ? 45 : -45); count = 0; } } WindowInfo.KeyUp(API.Keys.NUMPAD8); } }
/// <summary> /// PersistStringから復元 /// </summary> public static FormIntegrate FromPersistString( FormMain parent, String str ) { WindowInfo info = new WindowInfo(); info = (WindowInfo)info.Load( new StringReader( str.Substring( PREFIX.Length ) ) ); FormIntegrate form = new FormIntegrate( parent ); form.WindowData = info; return form; }
public GeneratedArchiveOperationForm(WindowInfo windowInfo, ArchiveGridType gridType) : base(gridType == ArchiveGridType.ArchiveUnboundGridLoadOnDemand ? (MyGrid)(new ArchiveUnboundWithDetailGridLoadOnDemand()) : (gridType == ArchiveGridType.ArchiveBoundGrid ? (MyGrid)(new ArchiveBoundGrid()) : null)) { Initialize(windowInfo); }
private static WindowInfo WindowInfoFromHandle( IntPtr hWnd ) { WindowInfo info = new WindowInfo(); StringBuilder sb = new StringBuilder( 256 ); WinAPI.GetClassName( hWnd, sb, sb.Capacity ); info.ClassName = new MatchString( sb.ToString(), MatchControl.Exact ); WinAPI.GetWindowText( hWnd, sb, sb.Capacity ); info.Title = new MatchString( sb.ToString(), MatchControl.Exact ); uint processId; WinAPI.GetWindowThreadProcessId( hWnd, out processId ); String fileName = GetMainModuleFilepath( (int)processId ); info.ProcessFilePath = new MatchString( fileName, MatchControl.Exact ); info.CurrentTitle = info.Title.Name; return info; }
public GeneratedArchiveOperationForm(WindowInfo windowInfo) : this(windowInfo, ArchiveGridType.ArchiveUnboundGridLoadOnDemand) { }
public static extern bool GetWindowInfo(IntPtr hwnd, out WindowInfo wi);
protected ImageInfo ExecuteRegionCapture(TaskSettings taskSettings) { ImageInfo imageInfo = new ImageInfo(); RegionCaptureMode mode; if (taskSettings.AdvancedSettings.RegionCaptureDisableAnnotation) { mode = RegionCaptureMode.Default; } else { mode = RegionCaptureMode.Annotation; } RegionCaptureForm form = new RegionCaptureForm(mode); try { form.Config = taskSettings.CaptureSettingsReference.SurfaceOptions; Screenshot screenshot = TaskHelpers.GetScreenshot(taskSettings); screenshot.CaptureCursor = false; Image img = screenshot.CaptureFullscreen(); CursorData cursorData = null; try { if (taskSettings.CaptureSettings.ShowCursor) { cursorData = new CursorData(); } form.Prepare(img); if (cursorData != null && cursorData.IsValid) { form.AddCursor(cursorData.Handle, cursorData.Position); } } finally { if (cursorData != null) { cursorData.Dispose(); } } form.ShowDialog(); imageInfo.Image = form.GetResultImage(); if (imageInfo.Image != null) { if (form.IsAnnotated) { AllowAnnotation = false; } if (form.Result == RegionResult.Region && taskSettings.UploadSettings.RegionCaptureUseWindowPattern) { WindowInfo windowInfo = form.GetWindowInfo(); imageInfo.UpdateInfo(windowInfo); } lastRegionCaptureType = RegionCaptureType.Default; } } finally { if (form != null) { form.Dispose(); } } return(imageInfo); }