{"id":925,"date":"2019-10-22T14:07:04","date_gmt":"2019-10-22T06:07:04","guid":{"rendered":"http:\/\/blog.5danyuan.com\/?p=925"},"modified":"2019-10-22T14:07:04","modified_gmt":"2019-10-22T06:07:04","slug":"c%e4%b8%ad%e6%8e%a5%e6%94%b6%e7%b3%bb%e7%bb%9f%e5%b1%8f%e5%b9%95%e9%94%81%e5%ae%9a%e5%92%8c%e8%a7%a3%e9%94%81%e7%9a%84%e4%ba%8b%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/blog.5danyuan.com\/?p=925","title":{"rendered":"C#\u4e2d\u63a5\u6536\u7cfb\u7edf\u5c4f\u5e55\u9501\u5b9a\u548c\u89e3\u9501\u7684\u4e8b\u4ef6"},"content":{"rendered":"\n<p>\u6700\u8fd1\u5728\u505a\u4e00\u4e2a demo\uff0c\u9700\u8981\u53bb\u76d1\u542c\u7528\u6237\u662f\u5426\u6709\u9501\u5c4f\uff0c\u6216\u8005\u6ce8\u9500\u64cd\u4f5c\u3002\u7528 C++ \u53ef\u4ee5\u53bb\u63a5\u6536\u7279\u5b9a\u7684\u6d88\u606f\u53bb\u5904\u7406\uff0c\u4f46\u6211\u603b\u89c9\u5f97 C# \u5e94\u8be5\u6709\u66f4\u597d\u7684\u5b9e\u73b0\u3002<\/p>\n\n\n\n<p>\u641c\u7d22\u4e86\u4e00\u756a\uff0c\u679c\u7136\u627e\u5230\u4e86\uff0c\u8fd8\u662f\u5fae\u8f6f\u597d\u5440\uff0c\u5565\u90fd\u4e3a\u6211\u4eec\u8003\u8651\u5230\u4e86\uff0c\u641e\u4e86\u4e00\u70b9\u52a8\u529b\u90fd\u6ca1\u6709\u3002<\/p>\n\n\n\n<p>\u4e3a\u4e86\u5b9e\u73b0\u8fd9\u6837\u7684\u6548\u679c\uff0c\u9700\u8981\u4f7f\u7528 Microsoft.Win32.SystemEvents \u7c7b\uff0c\u4ed6\u63d0\u4f9b\u4e86\u4e00\u4e9b\u4e8b\u4ef6\uff0c\u6211\u4eec\u53ef\u4ee5\u6ce8\u518c\u8fd9\u4e9b\u4e8b\u4ef6\u6765\u5b8c\u6210\u81ea\u5df1\u7684\u9700\u6c42\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Microsoft.Win32.SystemEvents.SessionSwitch += new Microsoft.Win32.SessionSwitchEventHandler(SystemEvents_SessionSwitch);  \nvoid SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)  \n{  \n  if (e.Reason == Microsoft.Win32.SessionSwitchReason.SessionLock)  \n  {   \n    \/\/ \u5c4f\u5e55\u9501\u5b9a  \n  }  \n  else if (e.Reason == Microsoft.Win32.SessionSwitchReason.SessionUnlock)  \n  {   \n    \/\/ \u5c4f\u5e55\u89e3\u9501  \n  }  \n}<\/code><\/pre>\n\n\n\n<p>\u662f\u4e0d\u662f\u5f88\u7b80\u5355\uff1f\u90fd\u4e0d\u9700\u8981\u5b9e\u4f8b\u5316\u7c7b\u3002\u4f46\u662f\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u56e0\u4e3a\u662f\u9759\u6001\u7c7b\uff0c\u6240\u4ee5\u5728\u5fc5\u8981\u7684\u65f6\u5019\uff0c\u9700\u8981\u663e\u793a\u5730\u53bb\u53d6\u6d88\u4e8b\u4ef6\u6ce8\u518c\uff0c\u4ee5\u907f\u514d\u5185\u5b58\u6cc4\u9732\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u5728\u505a\u4e00\u4e2a demo\uff0c\u9700\u8981\u53bb\u76d1\u542c\u7528\u6237\u662f\u5426\u6709\u9501\u5c4f\uff0c\u6216\u8005\u6ce8\u9500\u64cd\u4f5c\u3002\u7528 C++ \u53ef\u4ee5\u53bb\u63a5\u6536\u7279\u5b9a\u7684\u6d88\u606f\u53bb\u5904\u7406\uff0c\u4f46\u6211\u603b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[120],"class_list":["post-925","post","type-post","status-publish","format-standard","hentry","category-daily","tag-c-sharp"],"_links":{"self":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/posts\/925","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=925"}],"version-history":[{"count":0,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/posts\/925\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=925"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}