{"id":20603,"date":"2008-10-10T10:00:00","date_gmt":"2008-10-10T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2008\/10\/10\/how-do-i-suppress-the-capslock-warning-on-password-edit-controls\/"},"modified":"2008-10-10T10:00:00","modified_gmt":"2008-10-10T10:00:00","slug":"how-do-i-suppress-the-capslock-warning-on-password-edit-controls","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20081010-00\/?p=20603","title":{"rendered":"How do I suppress the CapsLock warning on password edit controls?"},"content":{"rendered":"<p><P>\nOne of the features added to\nversion&nbsp;6 of the shell common controls\nis a warning balloon that appears if CapsLock is on in a password control.\nLet&#8217;s demonstrate.\nTake the\n<A HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2003\/07\/23\/54576.aspx\">\nscratch program<\/A>,\nadd a manifest that requests version&nbsp;6 of the common controls\n(perhaps by using\n<A HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2007\/05\/31\/2995284.aspx\">\na Visual C++ extension<\/a>),\nand add the following:\n<\/P>\n<PRE>\nBOOL\nOnCreate(HWND hwnd, LPCREATESTRUCT lpcs)\n{\n    <FONT COLOR=\"blue\">g_hwndChild = CreateWindow(TEXT(&#8220;edit&#8221;), NULL,\n            ES_PASSWORD | WS_CHILD | WS_VISIBLE, 0, 0,\n            0, 0, hwnd, NULL, g_hinst, 0);\n    if (!g_hwndChild) return FALSE;<\/FONT><\/p>\n<p>    return TRUE;\n}\n<\/PRE>\n<P>\nRun this program and hit the CapsLock key.\nThe warning balloon should appear.\n(If it doesn&#8217;t, then your manifest is probably not working.)\n<\/P>\n<P>\nSuppose you want to suppress this warning balloon.\nWhy? I don&#8217;t know. Maybe you want to confuse your user.\nMaybe you think it looks ugly.\nWhatever the reason, you can suppress the balloon by\nsubclassing the edit control and swallowing the\n<CODE>EM_SHOWBALLOONTIP<\/CODE> message.\n<\/P>\n<PRE>\nWNDPROC g_wpEdit;<\/p>\n<p>LRESULT CALLBACK NoBalloonWndProc(HWND hwnd, UINT uMsg,\n                                  WPARAM wParam, LPARAM lParam)\n{\n  switch (uMsg) {\n  case EM_SHOWBALLOONTIP: return FALSE;\n  }\n  return CallWindowProc(g_wpEdit, hwnd, uMsg, wParam, lParam);\n}<\/p>\n<p>BOOL\nOnCreate(HWND hwnd, LPCREATESTRUCT lpcs)\n{\n    g_hwndChild = CreateWindow(TEXT(&#8220;edit&#8221;), NULL,\n            ES_PASSWORD | WS_CHILD | WS_VISIBLE, 0, 0,\n            0, 0, hwnd, NULL, g_hinst, 0);\n    if (!g_hwndChild) return FALSE;<\/p>\n<p>    <FONT COLOR=\"blue\">g_wpEdit = SubclassWindow(g_hwndChild, NoBalloonWndProc);<\/FONT><\/p>\n<p>    return TRUE;\n}\n<\/PRE>\n<P>\nWhen you run this modified program,\nyou&#8217;ll see that the balloon tip no longer appears\nbecause the subclass procedure intercepts all the\nballoon tips before the default edit control window\nprocedure can see them.\n<\/P>\n<P>\n[Raymond is currently away; this message was pre-recorded.]\n<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the features added to version&nbsp;6 of the shell common controls is a warning balloon that appears if CapsLock is on in a password control. Let&#8217;s demonstrate. Take the scratch program, add a manifest that requests version&nbsp;6 of the common controls (perhaps by using a Visual C++ extension), and add the following: BOOL OnCreate(HWND [&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":[25],"class_list":["post-20603","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>One of the features added to version&nbsp;6 of the shell common controls is a warning balloon that appears if CapsLock is on in a password control. Let&#8217;s demonstrate. Take the scratch program, add a manifest that requests version&nbsp;6 of the common controls (perhaps by using a Visual C++ extension), and add the following: BOOL OnCreate(HWND [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/20603","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=20603"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/20603\/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=20603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=20603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=20603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}