RSS

Monthly Archives: April 2013

Keyboard on the screen in WinForms


I found this code which work fine without any errors:

 

private void btnScreenkeyboar_Click(object sender, EventArgs e)
{

try
{
StartOSK();
}
catch (Exception error)
{
string err = error.ToString();
}

}

 

static void StartOSK()
{
  string windir = Environment.GetEnvironmentVariable("WINDIR");
  string osk = null;

  if (osk == null)
  {
    osk = Path.Combine(Path.Combine(windir, "sysnative"), "osk.exe");
    if (!File.Exists(osk))
      osk = null;
  }

  if (osk == null)
  {
    osk = Path.Combine(Path.Combine(windir, "system32"), "osk.exe");
    if (!File.Exists(osk))
    {
      osk = null;
    }
  }

  if (osk == null)
    osk = "osk.exe";

  Process.Start(osk);
}


keyboar
Advertisements
 
1 Comment

Posted by on April 9, 2013 in WinForm

 

Tags: , ,

Adding current time and date to web site


You need this within the <head></head> tags.

HTML Code:
 
 
<SCRIPT LANGUAGE="JavaScript">
function showDate()
{
	var now = new Date();
	var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
	var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
	var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
	function fourdigits(number)
	{
		return (number < 1000) ? number + 1900 : number;
	}
	
	tnow=new Date();
	thour=now.getHours();
	tmin=now.getMinutes();
	tsec=now.getSeconds();
	
	if (tmin<=9) { tmin="0"+tmin; }
	if (tsec<=9) { tsec="0"+tsec; }
	if (thour<10) { thour="0"+thour; }
	
	today = days[now.getDay()] + ", " + date + " " + months[now.getMonth()] + ", " + (fourdigits(now.getYear())) + " - " + thour + ":" + tmin +":"+ tsec;
	document.getElementById("dateDiv").innerHTML = today;
}
setInterval("showDate()", 1000);
</script>


Then this somewhere in your page.
HTML Code:
<div id="dateDiv"></div>


Image
 
Leave a comment

Posted by on April 4, 2013 in Uncategorized

 

Tags: , , ,