Example #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);
        }
Example #2
0
        public CHelpData GetHelpToView(Control ctrl)
        {
            CHelpData help = CHelpData.GetHelp(ctrl, "");

            while (!help.DejaEnregistre)
            {
                Type tp = ctrl.GetType();
                if (ctrl is CHelpData.CtrlPartiel)
                {
                    tp = ((CHelpData.CtrlPartiel)ctrl).Type;
                }
                while (tp != null)
                {
                    help = CHelpData.GetHelp(tp, "");
                    if (help.DejaEnregistre)
                    {
                        return(help);
                    }
                    tp = tp.BaseType;
                }
                ctrl = ctrl.Parent;
                if (ctrl == null)
                {
                    return(null);
                }
                help = CHelpData.GetHelp(ctrl, "");
            }
            return(help);
        }
Example #3
0
 private void btn_changerctrl_Click(object sender, EventArgs e)
 {
     if (m_help.Controle != null)
     {
         Control ctrl = CFormSelectControl.GetControl(m_help.Controle);
         if (ctrl != null)
         {
             if (AssureSave())
             {
                 m_help = CHelpData.GetHelp(ctrl, m_help.Contexte);
                 Initialiser(m_help);
             }
         }
     }
 }