<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Simon Steed&#039;s Blog About Stuff! &#187; System.Runtime.InteropServices SendInput NumLock Turn On c#</title>
	<atom:link href="http://blog.xploiter.com/tag/systemruntimeinteropservices-sendinput-numlock-turn-on-c/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.xploiter.com</link>
	<description>i.e. anything interesting...</description>
	<lastBuildDate>Wed, 01 Sep 2010 11:15:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4050</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>How to programmatically turn on the Numlock Key</title>
		<link>http://blog.xploiter.com/c-and-aspnet/how-to-programmatically-turn-on-the-numlock-key/</link>
		<comments>http://blog.xploiter.com/c-and-aspnet/how-to-programmatically-turn-on-the-numlock-key/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 10:19:57 +0000</pubDate>
		<dc:creator>Simon Steed</dc:creator>
				<category><![CDATA[C# and ASP.Net]]></category>
		<category><![CDATA[System.Runtime.InteropServices SendInput NumLock Turn On c#]]></category>

		<guid isPermaLink="false">http://simonsteed.wordpress.com/2008/11/07/how-to-programmatically-turn-on-the-numlock-key/</guid>
		<description><![CDATA[The following code will allow you to turn on the numlock key upon startup. Can&#8217;t credit anyone as i&#8217;m not sure where it came from but it does work 100% using System; using System.Runtime.InteropServices; class SetNumlockKeyOn { [StructLayout(LayoutKind.Sequential)] public struct INPUT { internal int type; internal short wVk; internal short wScan; internal int dwFlags; internal]]></description>
			<content:encoded><![CDATA[<p>The following code will allow you to turn on the numlock key upon startup. Can&#8217;t credit anyone as i&#8217;m not sure where it came from but it does work 100%</p>
<p>using System;<br />
using System.Runtime.InteropServices;</p>
<p>    class SetNumlockKeyOn<br />
    {<br />
        [StructLayout(LayoutKind.Sequential)]<br />
        public struct INPUT<br />
        {<br />
            internal int type;<br />
            internal short wVk;<br />
            internal short wScan;<br />
            internal int dwFlags;<br />
            internal int time;<br />
            internal IntPtr dwExtraInfo;<br />
            int dummy1;<br />
            int dummy2;<br />
            internal int type1;<br />
            internal short wVk1;<br />
            internal short wScan1;<br />
            internal int dwFlags1;<br />
            internal int time1;<br />
            internal IntPtr dwExtraInfo1;<br />
            int dummy3;<br />
            int dummy4;<br />
        }<br />
        [DllImport("user32.dll")]<br />
        static extern int SendInput(uint nInputs, IntPtr pInputs, int cbSize);</p>
<p>        public static void SetNumlockOn()<br />
        {<br />
            const int mouseInpSize = 28;//Hardcoded size of the MOUSEINPUT tag !!!<br />
            INPUT input = new INPUT();<br />
            input.type = 0&#215;01; //INPUT_KEYBOARD<br />
            input.wVk = 0&#215;90; //VK_NUMLOCK<br />
            input.wScan = 0;<br />
            input.dwFlags = 0; //key-down<br />
            input.time = 0;<br />
            input.dwExtraInfo = IntPtr.Zero;</p>
<p>            input.type1 = 0&#215;01;<br />
            input.wVk1 = 0&#215;90;<br />
            input.wScan1 = 0;<br />
            input.dwFlags1 = 2; //key-up<br />
            input.time1 = 0;<br />
            input.dwExtraInfo1 = IntPtr.Zero;</p>
<p>            IntPtr pI = Marshal.AllocHGlobal(mouseInpSize * 2);<br />
            Marshal.StructureToPtr(input, pI, false);<br />
            int result = SendInput(2, pI, mouseInpSize); //Hardcoded size of the MOUSEINPUT tag !!!</p>
<p>            //if (result == 0 || Marshal.GetLastWin32Error() != 0)<br />
            //    Console.WriteLine(Marshal.GetLastWin32Error());<br />
            Marshal.FreeHGlobal(pI);<br />
        }<br />
    }</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xploiter.com/c-and-aspnet/how-to-programmatically-turn-on-the-numlock-key/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
