{"id":1187,"date":"2011-03-31T18:28:12","date_gmt":"2011-03-31T16:28:12","guid":{"rendered":"https:\/\/alax.info\/blog\/?p=1187"},"modified":"2011-03-31T18:28:12","modified_gmt":"2011-03-31T16:28:12","slug":"you-cannot-remove-rbbs_nogripper-flag-from-rebar-band","status":"publish","type":"post","link":"https:\/\/alax.info\/blog\/1187","title":{"rendered":"You cannot remove RBBS_NOGRIPPER flag from rebar band"},"content":{"rendered":"<p>It is as stupid as it sounds: you can add RBBS_NOGRIPPER flag to a rebar band to implement &#8220;lock controls&#8221; feature, but as soon as you start removing it &#8211; you miserably fail.<\/p>\n<p><a href=\"http:\/\/tech.dir.groups.yahoo.com\/group\/wtl\/message\/13979\">A related thread on WTL group<\/a> is dated year 2006. You can find the same dated 2003. Now it&#8217;s 2011 and it&#8217;s still here.<\/p>\n<p>OK, it might be some bug in controlling code etc, but here is <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/bb773165%28VS.85%29.aspx\">Control Spy 2.0<\/a>. Here you go:<\/p>\n<ul>\n<li>rebar<\/li>\n<li><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/bb774451%28VS.85%29.aspx\">RB_GETBANDINFO<\/a>, <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/bb774393%28VS.85%29.aspx\">RBBIM_STYLE<\/a><\/li>\n<li>add RBBS_NOGRIPPER, Send<\/li>\n<li>remove RBBS_NOGRIPPER, Send<\/li>\n<li>ouch!<\/li>\n<\/ul>\n<p>WTL does a cool trick to fool the bastard:<\/p>\n<pre style=\"color: #000000; background: #ffffff;\"><span style=\"color: #800000; font-weight: bold;\">void<\/span> LockBands<span style=\"color: #808030;\">(<\/span><span style=\"color: #800000; font-weight: bold;\">bool<\/span> bLock<span style=\"color: #808030;\">)<\/span>\r\n<span style=\"color: #800080;\">{<\/span>\r\n    <span style=\"color: #800000; font-weight: bold;\">int<\/span> nBandCount <span style=\"color: #808030;\">=<\/span> GetBandCount<span style=\"color: #808030;\">(<\/span><span style=\"color: #808030;\">)<\/span><span style=\"color: #800080;\">;<\/span>\r\n    <span style=\"color: #800000; font-weight: bold;\">for<\/span><span style=\"color: #808030;\">(<\/span><span style=\"color: #800000; font-weight: bold;\">int<\/span> i <span style=\"color: #808030;\">=<\/span><span style=\"color: #008c00;\">0<\/span><span style=\"color: #800080;\">;<\/span> i <span style=\"color: #808030;\">&lt;<\/span> nBandCount<span style=\"color: #800080;\">;<\/span> i<span style=\"color: #808030;\">+<\/span><span style=\"color: #808030;\">+<\/span><span style=\"color: #808030;\">)<\/span>\r\n    <span style=\"color: #800080;\">{<\/span>\r\n        REBARBANDINFO rbbi <span style=\"color: #808030;\">=<\/span> <span style=\"color: #800080;\">{<\/span> RunTimeHelper<span style=\"color: #800080;\">::<\/span>SizeOf_REBARBANDINFO<span style=\"color: #808030;\">(<\/span><span style=\"color: #808030;\">)<\/span> <span style=\"color: #800080;\">}<\/span><span style=\"color: #800080;\">;<\/span>\r\n        rbbi<span style=\"color: #808030;\">.<\/span>fMask <span style=\"color: #808030;\">=<\/span> RBBIM_STYLE<span style=\"color: #800080;\">;<\/span>\r\n        <span style=\"color: #603000;\">BOOL<\/span> bRet <span style=\"color: #808030;\">=<\/span> GetBandInfo<span style=\"color: #808030;\">(<\/span>i<span style=\"color: #808030;\">,<\/span> <span style=\"color: #808030;\">&amp;<\/span>rbbi<span style=\"color: #808030;\">)<\/span><span style=\"color: #800080;\">;<\/span>\r\n        ATLASSERT<span style=\"color: #808030;\">(<\/span>bRet<span style=\"color: #808030;\">)<\/span><span style=\"color: #800080;\">;<\/span>\r\n\r\n        <span style=\"color: #800000; font-weight: bold;\">if<\/span><span style=\"color: #808030;\">(<\/span><span style=\"color: #808030;\">(<\/span>rbbi<span style=\"color: #808030;\">.<\/span>fStyle <span style=\"color: #808030;\">&amp;<\/span> RBBS_GRIPPERALWAYS<span style=\"color: #808030;\">)<\/span> <span style=\"color: #808030;\">=<\/span><span style=\"color: #808030;\">=<\/span> <span style=\"color: #008c00;\">0<\/span><span style=\"color: #808030;\">)<\/span>\r\n        <span style=\"color: #800080;\">{<\/span>\r\n            rbbi<span style=\"color: #808030;\">.<\/span>fStyle <span style=\"color: #808030;\">|<\/span><span style=\"color: #808030;\">=<\/span> RBBS_GRIPPERALWAYS<span style=\"color: #800080;\">;<\/span>\r\n            bRet <span style=\"color: #808030;\">=<\/span> SetBandInfo<span style=\"color: #808030;\">(<\/span>i<span style=\"color: #808030;\">,<\/span> <span style=\"color: #808030;\">&amp;<\/span>rbbi<span style=\"color: #808030;\">)<\/span><span style=\"color: #800080;\">;<\/span>\r\n            ATLASSERT<span style=\"color: #808030;\">(<\/span>bRet<span style=\"color: #808030;\">)<\/span><span style=\"color: #800080;\">;<\/span>\r\n            rbbi<span style=\"color: #808030;\">.<\/span>fStyle <span style=\"color: #808030;\">&amp;<\/span><span style=\"color: #808030;\">=<\/span> <span style=\"color: #808030;\">~<\/span>RBBS_GRIPPERALWAYS<span style=\"color: #800080;\">;<\/span>\r\n        <span style=\"color: #800080;\">}<\/span>\r\n        <span style=\"color: #800000; font-weight: bold;\">if<\/span><span style=\"color: #808030;\">(<\/span>bLock<span style=\"color: #808030;\">)<\/span>\r\n            rbbi<span style=\"color: #808030;\">.<\/span>fStyle <span style=\"color: #808030;\">|<\/span><span style=\"color: #808030;\">=<\/span> RBBS_NOGRIPPER<span style=\"color: #800080;\">;<\/span>\r\n        <span style=\"color: #800000; font-weight: bold;\">else<\/span>\r\n            rbbi<span style=\"color: #808030;\">.<\/span>fStyle <span style=\"color: #808030;\">&amp;<\/span><span style=\"color: #808030;\">=<\/span> <span style=\"color: #808030;\">~<\/span>RBBS_NOGRIPPER<span style=\"color: #800080;\">;<\/span>\r\n\r\n        bRet <span style=\"color: #808030;\">=<\/span> SetBandInfo<span style=\"color: #808030;\">(<\/span>i<span style=\"color: #808030;\">,<\/span> <span style=\"color: #808030;\">&amp;<\/span>rbbi<span style=\"color: #808030;\">)<\/span><span style=\"color: #800080;\">;<\/span>\r\n        ATLASSERT<span style=\"color: #808030;\">(<\/span>bRet<span style=\"color: #808030;\">)<\/span><span style=\"color: #800080;\">;<\/span>\r\n    <span style=\"color: #800080;\">}<\/span>\r\n<span style=\"color: #800080;\">}<\/span><\/pre>\n<p>Pretty cool and works&#8230; if you have one rebar only. If you have another one in the same window (e.g. mine is at bottom) &#8211; you fail again.<\/p>\n<p>A nasty workaround is to nudge hosting window by resizing it, followed by a full cycle of internal layout updates:<\/p>\n<pre style='color:#000000;background:#ffffff;'><span style='color:#603000; '>CRect<\/span> Position<span style='color:#800080; '>;<\/span>\r\nATLVERIFY<span style='color:#808030; '>(<\/span><span style='color:#400000; '>GetWindowRect<\/span><span style='color:#808030; '>(<\/span>Position<span style='color:#808030; '>)<\/span><span style='color:#808030; '>)<\/span><span style='color:#800080; '>;<\/span>\r\nPosition<span style='color:#808030; '>.<\/span>bottom<span style='color:#808030; '>+<\/span><span style='color:#808030; '>+<\/span><span style='color:#800080; '>;<\/span>\r\nATLVERIFY<span style='color:#808030; '>(<\/span><span style='color:#400000; '>MoveWindow<\/span><span style='color:#808030; '>(<\/span>Position<span style='color:#808030; '>)<\/span><span style='color:#808030; '>)<\/span><span style='color:#800080; '>;<\/span>\r\nPosition<span style='color:#808030; '>.<\/span>bottom<span style='color:#808030; '>-<\/span><span style='color:#808030; '>-<\/span><span style='color:#800080; '>;<\/span>\r\nATLVERIFY<span style='color:#808030; '>(<\/span><span style='color:#400000; '>MoveWindow<\/span><span style='color:#808030; '>(<\/span>Position<span style='color:#808030; '>)<\/span><span style='color:#808030; '>)<\/span><span style='color:#800080; '>;<\/span>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>It is as stupid as it sounds: you can add RBBS_NOGRIPPER flag to a rebar band to implement &#8220;lock controls&#8221; feature, but as soon as you start removing it &#8211; you miserably fail. A related thread on WTL group is dated year 2006. You can find the same dated 2003. Now it&#8217;s 2011 and it&#8217;s&hellip; <\/p>\n<p><a class=\"moretag\" href=\"https:\/\/alax.info\/blog\/1187\">Read the full article<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,20],"tags":[63,328,488,489],"class_list":["post-1187","post","type-post","status-publish","format-standard","hentry","category-source","category-wtl","tag-bug","tag-rebar","tag-source","tag-wtl"],"_links":{"self":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/1187","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/comments?post=1187"}],"version-history":[{"count":0,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/1187\/revisions"}],"wp:attachment":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/media?parent=1187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/categories?post=1187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/tags?post=1187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}