{"id":48,"date":"2009-01-16T13:19:34","date_gmt":"2009-01-16T07:49:34","guid":{"rendered":"http:\/\/www.sanchitkarve.com\/blog\/?p=48"},"modified":"2009-01-16T13:19:34","modified_gmt":"2009-01-16T07:49:34","slug":"visual-basic-6-internal-event-handling","status":"publish","type":"post","link":"https:\/\/www.sanchitkarve.com\/blog\/2009\/01\/16\/visual-basic-6-internal-event-handling\/","title":{"rendered":"Visual Basic 6 Internal Event Handling"},"content":{"rendered":"<p>VB6 calls control events in a very specific way. It&#8217;s impressive but the design of event handling results in losing a certain number of guaranteed bytes per control used. By losing bytes, I am referring to the addition of redundant bytes in the executable code.<\/p>\n<p>I studied the entire structure with Disassemblers and debuggers and found out that the total number of redundant bytes is \u00a0governed by the following formula:<\/p>\n<p><strong>Total Redundant Bytes = SUMMATION OF (4 x (Number_Of_Events + 6 &#8211; Events_Used) ) FROM 1 TO N<\/strong><\/p>\n<p><em>where:<br \/>\n<strong>N<\/strong> = Total Number of Controls Used<br \/>\n<strong>Number_Of_Events<\/strong> = Total Number Events Supported by a Control (Different for each control)<br \/>\n<strong>Events_Used<\/strong> = Number of Events Used for each control.<\/em><\/p>\n<p>So Imagine a simple form having two text boxes and 1 command button for a simple login box, considering that only the following events are used:<br \/>\n<em>Form_Load()<br \/>\nCommand1_Click()<\/em><br \/>\nThe Total number of Redundant Bytes is:<br \/>\n(4*(31+6-1)) + 2*(4*(24+6)) + (4*(17+6-1)) = 472<br \/>\n1 FORM + 2 TEXT BOXES + 1 CMD BTN<\/p>\n<p>That&#8217;s <strong>472 unnecessary bytes<\/strong> just for a simple login box using absolutely no user-written code.<\/p>\n<p>Many people refer to VB6 as Visual Bloatware, and you now know why \ud83d\ude09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>VB6 calls control events in a very specific way. It&#8217;s impressive but the design of event handling results in losing a certain number of guaranteed bytes per control used. By losing bytes, I am referring to the addition of redundant bytes in the executable code. I studied the entire structure with Disassemblers and debuggers and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[58,66,70],"_links":{"self":[{"href":"https:\/\/www.sanchitkarve.com\/blog\/wp-json\/wp\/v2\/posts\/48"}],"collection":[{"href":"https:\/\/www.sanchitkarve.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sanchitkarve.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sanchitkarve.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sanchitkarve.com\/blog\/wp-json\/wp\/v2\/comments?post=48"}],"version-history":[{"count":0,"href":"https:\/\/www.sanchitkarve.com\/blog\/wp-json\/wp\/v2\/posts\/48\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sanchitkarve.com\/blog\/wp-json\/wp\/v2\/media?parent=48"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sanchitkarve.com\/blog\/wp-json\/wp\/v2\/categories?post=48"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sanchitkarve.com\/blog\/wp-json\/wp\/v2\/tags?post=48"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}