{"id":60,"date":"2011-08-27T19:56:22","date_gmt":"2011-08-27T19:56:22","guid":{"rendered":"http:\/\/www.gironsec.com\/blog\/?p=60"},"modified":"2013-10-27T10:54:05","modified_gmt":"2013-10-27T10:54:05","slug":"stupid-windows","status":"publish","type":"post","link":"https:\/\/www.gironsec.com\/blog\/2011\/08\/stupid-windows\/","title":{"rendered":"Stupid windows"},"content":{"rendered":"<p>What do you do if you accidentally bump the power button on windows and everything is about to shut down? I&#8217;ll tell you what I do, alt + f2. My program sits in the background and works on 9x &#8211; win7.<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #f0f0f0; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #007020\">#include &lt;windows.h&gt;<\/span>\r\n<span style=\"color: #007020\">#DEFINE ID 89023<\/span>\r\n<span style=\"color: #902000\">int<\/span> <span style=\"color: #06287e\">main<\/span>(<span style=\"color: #902000\">void<\/span>)\r\n{\r\nHWND deskwin <span style=\"color: #666666\">=<\/span> GetDesktopWindow();\r\nRegisterHotKey(deskwin,ID, <span style=\"color: #40a070\">0x0008<\/span>,<span style=\"color: #40a070\">0x66<\/span>);\r\nMSG msg <span style=\"color: #666666\">=<\/span> {<span style=\"color: #40a070\">0<\/span>};\r\n<span style=\"color: #007020; font-weight: bold\">while<\/span> (GetMessage(<span style=\"color: #666666\">&amp;<\/span>amp;msg, <span style=\"color: #007020\">NULL<\/span>, <span style=\"color: #40a070\">0<\/span>, <span style=\"color: #40a070\">0<\/span>) <span style=\"color: #666666\">!=<\/span> <span style=\"color: #40a070\">0<\/span>)\r\n{\r\n<span style=\"color: #007020; font-weight: bold\">if<\/span> (msg.message <span style=\"color: #666666\">==<\/span> WM_HOTKEY)\r\n{\r\nAbortSystemShutdown(<span style=\"color: #007020\">NULL<\/span>);\r\n}\r\n}\r\n<span style=\"color: #007020; font-weight: bold\">return<\/span> <span style=\"color: #40a070\">0<\/span>;\r\n}\r\n<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>What do you do if you accidentally bump the power button on windows and everything is about to shut down? I&#8217;ll tell you what I do, alt + f2. My program sits in the background and works on 9x &#8211; win7. #include &lt;windows.h&gt; #DEFINE ID 89023 int main(void) { HWND deskwin = GetDesktopWindow(); RegisterHotKey(deskwin,ID, 0x0008,0x66); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/posts\/60"}],"collection":[{"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/comments?post=60"}],"version-history":[{"count":2,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/posts\/60\/revisions"}],"predecessor-version":[{"id":566,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/posts\/60\/revisions\/566"}],"wp:attachment":[{"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/media?parent=60"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/categories?post=60"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/tags?post=60"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}