Пример #1
0
        private static int OnHook(int nCode, int wParam, int lParam)
        {
            try
            {
                if (nCode == 0)
                {
                    if (wParam == (int)Keys.F1)
                    {
                        if (lParam < 0)
                        {
                            Process process = Process.GetProcessById(m_nIdProcess);
                            Control ctrl    = null;
                            if (process != null)
                            {
                                ctrl = System.Windows.Forms.Form.ActiveForm;
                            }
                            if (ctrl != null)
                            {
                                m_lastControl = ctrl;
                                ctrl          = FindFocused(ctrl);
                                m_nNbFormvisible++;
                                try
                                {
                                    if (m_nNbFormvisible == 1)
                                    {
                                        Control pere = ctrl;
                                        while (pere != null)
                                        {
                                            //if (pere.GetType() == typeof(MdiClient))
                                            //    pere = null;
                                            //else
                                            //{
                                            CHelpData.FenetreActive = pere;

                                            pere = pere.Parent;
                                            //}
                                        }

                                        CHelpData help = CHelpData.GetHelp(ctrl, "");
                                        CFormAide.ShowHelp(help, ctrl);
                                    }
                                }
                                catch
                                {
                                    //MessageBox.Show(e.Message);
                                }
                                finally
                                {
                                    m_nNbFormvisible--;
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
            }
            return(0);
        }
Пример #2
0
 public static void ShowHelp(CHelpData help, Control owner)
 {
     if (m_form == null || m_form.Owner != owner)
     {
         if (m_form != null)
         {
             m_form.Visible = false;
             m_form.Dispose();
             m_form = null;
         }
         m_form          = new CFormAide();
         m_form.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - m_form.Width);
         m_form.Size     = new Size(m_form.Width, Screen.PrimaryScreen.WorkingArea.Height);
     }
     m_form.Initialiser(help);
 }