Example #1
0
        private void ProcessSetter()
        {
            List <IntPtr> processes = WindowManagement.FindWindowsWithText(ProcessName.Text.Trim(), true);

            if (processes.Count > 0)
            {
                procSet         = true;
                PrcNameLbl.Text = "Window Title Name: Set";
            }
            else
            {
                MessageBox.Show("No windows were found with \"" + ProcessName.Text.Trim() + "\" in the title");
                PrcNameLbl.Text  = "Window Title Name: Not Set";
                ProcessName.Text = "Enter the window title";
                procSet          = false;
            }
        }
Example #2
0
        private void _DisplayErrorLabel()
        {
            this._Page.PageTitle = _Page.PageTitle + " (" + RsViewEngine.Locale.GetTagText("error") + ")";

            this.SuspendLayout();

            _ErrorLabel             = new Label();
            _ErrorLabel.Name        = "lErrorLabel";
            _ErrorLabel.BackColor   = Color.FromArgb(255, 255, 200, 200);
            _ErrorLabel.TextAlign   = ContentAlignment.MiddleCenter;
            _ErrorLabel.Text        = RsViewEngine.Locale.GetTagText("appCrashedNotify");
            _ErrorLabel.BorderStyle = BorderStyle.FixedSingle;
            _ErrorLabel.Location    = new Point(0, 0);
            _ErrorLabel.Size        = new Size(this.ClientRectangle.Width, this.ClientRectangle.Height);
            _ErrorLabel.Font        = RsViewEngine.TitleFont;
            _ErrorLabel.Anchor      = (AnchorStyles)(AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom);

            this.Controls.Add(_ErrorLabel);
            _ErrorLabel.BringToFront();

            this.ResumeLayout();

            WindowManagement.SetParent(_ChildHandle, 0);
        }
Example #3
0
        private void Start_Click(object sender, EventArgs e)
        {
            if (Directory.GetFiles(SelectectedFolder.Text, "*", SearchOption.TopDirectoryOnly).Length > 0)
            {
                MessageBox.Show("In order to work properly Book Snatcher needs to save to an empty folder"
                                + NL() + "Please create a new folder to use");
                SelectectedFolder.Text = "Choose a folder for the screenshots to go";
            }
            else if (started == false && (Directory.GetFiles(SelectectedFolder.Text, "*", SearchOption.TopDirectoryOnly).Length < 1))
            {
                started = true;
                if (WindowManagement.FindWindowsWithText(ProcessName.Text.Trim(), true).Count > 0)
                {
                    readerhWnd = WindowManagement.FindWindowsWithText(ProcessName.Text.Trim(), true)[0];
                }
                else
                {
                    MessageBox.Show("No windows with \"" + ProcessName.Text.Trim() + "\" in the title were found");
                    return;
                }
                this.Width = 548;

                i = 1;
                HowDoIScreenShotted();
                SetForegroundWindow(this.Handle);
                if (i == numberOfPages + 1)
                {
                    MessageBox.Show("Done!"
                                    + NL() + numberOfPages.ToString() + " screenshots."
                                    + NL() + "Saved to: " + SelectectedFolder.Text);
                    started = false;
                    Tracker();
                    this.Width = 473;
                }
            }
        }
Example #4
0
        protected override void WndProc(ref Message m)
        {
            bool lDecTimeout = false;

            switch (m.Msg)
            {
            case Messaging.WM_REGISTERACCEPTED:
                _Timer.Enabled = true;
                break;

            case Messaging.WM_PARENTRESIZED:
                if (EmbeddedApplication != null)
                {
                    Rect lRect;
                    WindowManagement.GetClientRect(EmbeddedApplication.Handle, out lRect);
                    this.Size = new Size(lRect.Width, lRect.Height);
                }
                break;

            case RSAppMessages.WM_PRINT:
                if (opened)
                {
                    if (!_offline)
                    {
                        ctlViewer.PrintReport();
                    }
                    else
                    {
                        _pdfCtl.Print();
                    }
                }
                break;

            case RSAppMessages.WM_REFRESH:
                DoRefresh();
                break;

            case RSAppMessages.WM_MAIL:
                DoSendEmail();
                break;

            case RSAppMessages.WM_OFFLINE:
                if (_offline)
                {
                    DoOnline();
                }
                else
                {
                    DoOffline();
                }
                break;

            case RSAppMessages.WM_THUMB:
                switch ((int)(m.WParam))
                {
                case RSAppMessages.EX_FIRST: DoFirstPage(); break;

                case RSAppMessages.EX_PREV: DoPrevPage(); break;

                case RSAppMessages.EX_NEXT: DoNextPage(); break;

                case RSAppMessages.EX_LAST: DoLastPage(); break;
                }
                break;

            case RSAppMessages.WM_ZOOM:
                switch ((int)(m.WParam))
                {
                case RSAppMessages.EX_SET:
                    DoZoom((int)(m.LParam));
                    break;

                case RSAppMessages.EX_GET:
                    Messaging.PostMessage(EmbeddedApplication.Handle, RSAppMessages.WM_ZOOM, RSAppMessages.EX_SET, _Zoom);
                    break;
                }
                break;

            case RSAppMessages.WM_GROUP:
                switch ((int)(m.WParam))
                {
                case RSAppMessages.EX_SHOW:
                    DoShowGroup(true);
                    break;

                case RSAppMessages.EX_HIDE:
                    DoShowGroup(false);
                    break;

                case RSAppMessages.EX_GET:

                    Messaging.PostMessage(EmbeddedApplication.Handle, RSAppMessages.WM_GROUP, (uint)getGroupState(), 0);
                    break;
                }

                break;

            case RSAppMessages.WM_UI:
                uint aFlags = RSAppMessages.EncodeEmbedded(this);
                Messaging.PostMessage(EmbeddedApplication.Handle, RSAppMessages.WM_UI, aFlags, 0);
                break;

            case RSAppMessages.WM_EXPORT:
                switch ((int)(m.WParam))
                {
                case RSAppMessages.EX_PDF:
                    DoExportPDF();
                    break;

                case RSAppMessages.EX_XLS:
                    DoExportExcel();
                    break;

                case RSAppMessages.EX_XLS_DATAONLY:
                    DoExportToExcelDataOnly();
                    break;

                case RSAppMessages.EX_DOC:
                    DoExportWord();
                    break;

                case RSAppMessages.EX_XML:
                    DoExportXML();
                    break;

                case RSAppMessages.EX_HTM32:
                    DoExportHTML32();
                    break;

                case RSAppMessages.EX_HTM40:
                    DoExportHTML40();
                    break;
                }
                break;

            default:
                lDecTimeout = true;
                base.WndProc(ref m);
                break;
            }

            if (!lDecTimeout)
            {
                _timeout = RsViewEngine.ProfileManager.Profile.Settings.Offline.Timeout * 60;
            }
        }
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (args != null && args.Length != 0)
            {
                cmdArgs tmpArgs = new cmdArgs(args);

                string   WaitForWindowName       = string.Empty;
                bool     WaitForForeGroundWindow = false;
                int      WaitTimeOut             = -1;
                DateTime startTime = DateTime.Now;

                if (tmpArgs.ArgExists("WindowName"))
                {
                    WaitForWindowName = tmpArgs.Values[tmpArgs.FindArgPos("WindowName")];
                }
                if (tmpArgs.ArgExists("ForeGroundWindowName"))
                {
                    WaitForWindowName       = tmpArgs.Values[tmpArgs.FindArgPos("ForeGroundWindowName")];
                    WaitForForeGroundWindow = true;
                }

                if (tmpArgs.ArgExists("WaitTimeOut"))
                {
                    int.TryParse(tmpArgs.Values[tmpArgs.FindArgPos("WaitTimeOut")], out WaitTimeOut);
                }

                if (WaitForWindowName != string.Empty)
                {
                    IntPtr tmpFoundWindowHandle = IntPtr.Zero;
                    WindowManagement.GetHandleFromPartialCaption(ref tmpFoundWindowHandle, WaitForWindowName);

                    while (tmpFoundWindowHandle == IntPtr.Zero || (WaitForForeGroundWindow && WindowManagement.GetForegroundWindow() != tmpFoundWindowHandle))
                    {
                        System.Threading.Thread.Sleep(250);
                        WindowManagement.GetHandleFromPartialCaption(ref tmpFoundWindowHandle, WaitForWindowName);

                        if (WaitTimeOut != -1)
                        {
                            TimeSpan tmpSpan = DateTime.Now - startTime;
                            if (WaitTimeOut <= tmpSpan.TotalMilliseconds)
                            {
                                System.Environment.Exit(1);
                            }
                        }
                    }
                }
            }

            System.Environment.Exit(0);
        }