Pages

Different type of events Available in Javscript

Events associated with Mouse: onmousemove: If the user moves a button, then the events associated with onmousemove fire. onclick: onclick events fire when the mouse button clicks. ondblclick: The event ondblclick fires when the mouse button is double clicked. There are also some events associated with the mouse pointer position such as: onmouseout: onmouseout event fires if the mouse pointer position is out of focus from the element. onmouseover: onmouseover event fires if the mouse pointer position is in focus of the element position. The above are some of the various mouse events available in JavaScript. Events associated with Keyboard: onkeydown onkeyup onkeypress onkeydown: onkeydown event fires when key is pressed. onkeyup: onkeyup event fires when key is released. onkeypress: The event onkeypress fires if the onkeydown is followed by onkeyup. There are many additional events available in JavaScript. A few are listed below: onerror: onerror event fires when an error occurs. onfocus: When a element gains focus, onfocus event fires or executes. onblur: In contrast to an onfocus event, this event fires when the element loses its focus. Both onfocus and onblur may be used for handling validation of forms. onsubmit: The event onsubmit fires when the command form submit is given. This event is used for validating all fields in the form before submitting the form. onload: onload event automatically executes as soon as the document fully loads. This loads when the user enters the page. This is a commonly used event. This event is used to check compatibility with the browser version and type. Based on this compatibility, the appropriate version of a page will then load. onunload: In contrast to onload event, the onunload event fires when the user leaves the page.

Running Window Application using Window Service

How to run window apllication in specfic interval from window service 1)Create window service application(Assume Creation of window service known) 2)Use Namespace system .Timer add timer.start in start method of windowservice 3)Add Time elapsed event handler mechanism in start method of window service 4)In Timeelapsed event add following line code Process proc; proc = new Process(); proc.StartInfo.FileName = @"C:\windowapplicationName.exe"; proc.StartInfo.Arguments = "jhgj";[optional] proc.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; proc.Start(); 5)After install service in service controler right click on service name then click properties under login tab enable Allow service to interact with desktop (For Automatic enable review code given below add name space Microsoft.win32 in code) 6)Start service
Declartion in Class Member Section /////////// Process p = new Process(); // int ncount = 0; int iProcessID = 0; System.Timers.Timer objtimer = new Timer(1000); ////////// Code for start Method ////////// this.objtimer.Enabled = true; this.objtimer.Start(); this.objtimer.Elapsed += new System.Timers.ElapsedEventHandler(timer1_Elapsed); //Automatatically enable window service for inter active desktop // Here is where we set the bit on the value in the registry. //Reference from CodeProject.com // Grab the subkey to our service RegistryKey ckey = Registry.LocalMachine.OpenSubKey( @"SYSTEM\CurrentControlSet\Services\Sample", true); // Good to always do error checking! if (ckey != null) { // Ok now lets make sure the "Type" value is there, //and then do our bitwise operation on it. if (ckey.GetValue("Type") != null) { ckey.SetValue("Type", ((int)ckey.GetValue("Type") | 256)); } } ///////// Code for Timer Elapsed event ///////// ///here if condtion are used to check not to run same process again if process is already running try { if (iProcessID != 0) { Process[] objProcesses = System.Diagnostics.Process.GetProcesses(); bool IsExists = false; foreach (Process prc in objProcesses) { if (prc.Id == iProcessID) { IsExists = true; } } if (IsExists == false) iProcessID = 0; } if (iProcessID == 0) { Process proc; proc = new Process(); proc.StartInfo.FileName = @"C:\TrayDemo.exe"; proc.StartInfo.Arguments = "jhgj"; proc.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; if (proc.Start()) { iProcessID = proc.Id; } } } catch (Exception ex) { //MessageBox.Show(ex.ToString()); } /////////////