{"id":26523,"date":"2007-06-07T10:00:00","date_gmt":"2007-06-07T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2007\/06\/07\/how-do-i-inflate-a-bicycle-tire-with-a-potato\/"},"modified":"2007-06-07T10:00:00","modified_gmt":"2007-06-07T10:00:00","slug":"how-do-i-inflate-a-bicycle-tire-with-a-potato","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20070607-00\/?p=26523","title":{"rendered":"How do I inflate a bicycle tire with a potato?"},"content":{"rendered":"<p>\nI see this all the time.\n<\/p>\n<p>\nPeople have a problem and have already decided what technology they&#8217;re\ngoing to use to solve it, and then they hit a roadblock:\nThe technology they picked is unsuited to the problem!\n<\/p>\n<blockquote CLASS=\"q\"><p>\nHow do I put my laptop into standby mode from VBScript?\n<\/p><\/blockquote>\n<blockquote CLASS=\"q\"><p>\nHow do I change the user&#8217;s mouse acceleration from a batch file?\nI changed the registry values but it doesn&#8217;t take effect immediately.\n<\/p><\/blockquote>\n<p>\nThe functionality you seek is implemented in native code via Win32.\nAt the end of the day, the solution involves calling\n<code>SetSystemPowerState<\/code> or\n<code>SystemParametersInfo(SPI_SETMOUSE)<\/code>,\nsince those are the functions that actually do the work.\n<\/p>\n<p>\nThere&#8217;s no law that forbids writing programs in C or C++,\nparticularly since that&#8217;s the target language for the native\nbits of Win32.\nGo ahead, write that program, and then call it from your batch file.\n<\/p>\n<p>\nNow, it&#8217;s possible that you can get somebody else to play\nmiddle-man for you.\nFor example, if you wanted to shut down the computer,\nyou can get the <code>shutdown.exe<\/code> program to help out.\nAnd if you had chosen wisely,\nthe technology you already decided upon may wrap the Win32\nfunctionality inside a helper function or class,\nor it may provide\na way of calling into native Win32 code. For example,\nyour Visual Basic program could just call <code>SetSystemPowerState<\/code>\nvia a platform invoke:\n<\/p>\n<pre>\n&lt;DllImport(\"kernel32.dll\")&gt;\nPublic Shared Function SetSystemPowerState(_\n      fSuspend As Boolean, _\n      fForce As Boolean) As Boolean\nSetSystemPowerState(True, False)\n<\/pre>\n<p>\n(Note: I don&#8217;t speak Visual Basic, so I may have gotten the details\nwrong, but I hope you get the idea.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I see this all the time. People have a problem and have already decided what technology they&#8217;re going to use to solve it, and then they hit a roadblock: The technology they picked is unsuited to the problem! How do I put my laptop into standby mode from VBScript? How do I change the user&#8217;s [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[26],"class_list":["post-26523","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other"],"acf":[],"blog_post_summary":"<p>I see this all the time. People have a problem and have already decided what technology they&#8217;re going to use to solve it, and then they hit a roadblock: The technology they picked is unsuited to the problem! How do I put my laptop into standby mode from VBScript? How do I change the user&#8217;s [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/26523","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=26523"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/26523\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=26523"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=26523"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=26523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}