/// <summary>
        /// Methods to be called and work that has to be done while
        /// loading this form.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LoginForm_Load(object sender, EventArgs e)
        {
            this.userNameTextbox.Focus();
            try
            {
                screenLockObj.enableHook(this, e);

                this.ActiveControl = userNameTextbox;
                int winCount = screenLockObj.countWindows();
                winCount = winCount - 1; // I am assuming that user is not interested in
                                         // counting this process.
                if (winCount == 0)
                {
                    this.programCountMessageLabel.Text = " No program is running ";
                }
                else if (winCount == 1)
                {
                    this.programCountMessageLabel.Text = " One program is running ";
                }
                else
                {
                    this.programCountMessageLabel.Text = winCount + " programs are running";
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="slh"></param>
 internal static void reloadHook(ScreenLockHelper slh)
 {
     try
     {
         screenLockHelperStatic = slh;
         screenLockHelperStatic.minimizeWindow();
         screenLockHelperStatic.releaseHook();
         screenLockHelperStatic.enableHook(backgroundScreenStatic, new EventArgs());
     }
     catch (Exception e)
     {
     }
 }
Exemplo n.º 3
0
        // <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BackgroundScreen_Load(object sender, EventArgs e)
        {
            Environment.CurrentDirectory = @"C:\Documents and Settings\Administrator\Desktop\vinay\ScreenLock\ScreenLock\bin\Debug\profiles";
            this.SetTopLevel(true);
            try
            {
                //    screenLockHelperObj.enableHook(this, new EventArgs());
                screenLockHelperObj.killtaskmgr();
                screenLockHelperObj.addtoStartup();
                screenLockHelperObj.minimizeWindow();
            }
            catch (Exception ex)
            {
            }
            screenLockHelperObj.enableHook(backgroundScreenStatic, new EventArgs());
            backgroundScreenStatic.BringToFront();
            loginFormStatic = loginFormObj;
            loginFormStatic.Show();
            loginFormStatic.BringToFront();

            // reloadHook(screenLockHelperObj);
            //int i = 20;
        }