{"id":27593,"date":"2007-03-16T10:00:00","date_gmt":"2007-03-16T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2007\/03\/16\/the-format-of-accelerator-table-resources\/"},"modified":"2007-03-16T10:00:00","modified_gmt":"2007-03-16T10:00:00","slug":"the-format-of-accelerator-table-resources","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20070316-00\/?p=27593","title":{"rendered":"The format of accelerator table resources"},"content":{"rendered":"<p>\nContinuing in the extremely sporadic series on the format of\nresources, today we&#8217;ll take a look at accelerator tables.\nThis topic is so simple, I&#8217;ll cover both 16-bit and 32-bit\nresources on the same day!\n<\/p>\n<p>\nIn 16-bit Windows, the format of an accelerator table resource\nwas simply an array of\n<a HREF=\"http:\/\/msdn.microsoft.com\/library\/en-us\/winui\/winui\/windowsuserinterface\/userinput\/keyboardaccelerators\/keyboardacceleratorreference\/keyboardacceleratorstructures\/accel.asp\">\n<code>ACCEL<\/code> structures<\/a>.\n<\/p>\n<pre>\ntypedef struct tagACCEL {\n    BYTE fVirt;\n    BYTE bPadding; \/* making the padding explicit *\/\n    WORD key;\n    WORD cmd;\n} ACCEL, *LPACCEL;\n<\/pre>\n<p>\nThis array is the same array you would pass to the\n<code>CreateAcceleratorTable<\/code>, with one important difference:\nThe <code>fVirt<\/code> of the last entry in the accelerator resource\nhas its high bit set to indicate that it is the end of the table.\n<\/p>\n<p>\nThe format of 32-bit accelerator table resources is nearly identical\nto its 16-bit counterpart.\nThe only difference is the addition of an additional word of padding\nto bring the size of the structure up to a multiple of four bytes.\n<\/p>\n<pre>\ntypedef struct tagACCEL_RESOURCE {\n    BYTE fVirt;\n    BYTE bPadding; \/* making the padding explicit *\/\n    WORD key;\n    WORD cmd;\n    WORD wPadding; \/* making the padding explicit *\/\n} ACCEL_RESOURCE;\n<\/pre>\n<p>\nOnce again, the last entry is marked by setting the high bit\nof the <code>fVirt<\/code> member.\nThe extra word of padding adds a second obstacle to taking the resource\ndata and passing it to the <code>CreateAcceleratorTable<\/code>\nfunction to create the accelerator table manually.\nNot only do you have to strip off the high bit of the <code>fVirt<\/code>,\nyou also have to convert the table to an array of <code>ACCEL<\/code>\nstructures\nand pass the converted table to the\n<code>CreateAcceleratorTable<\/code> function.\n<\/p>\n<p>\nThat&#8217;s all there is to the format of accelerator table resources.\nI told you it was pretty simple.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Continuing in the extremely sporadic series on the format of resources, today we&#8217;ll take a look at accelerator tables. This topic is so simple, I&#8217;ll cover both 16-bit and 32-bit resources on the same day! In 16-bit Windows, the format of an accelerator table resource was simply an array of ACCEL structures. typedef struct tagACCEL [&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-27593","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Continuing in the extremely sporadic series on the format of resources, today we&#8217;ll take a look at accelerator tables. This topic is so simple, I&#8217;ll cover both 16-bit and 32-bit resources on the same day! In 16-bit Windows, the format of an accelerator table resource was simply an array of ACCEL structures. typedef struct tagACCEL [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/27593","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=27593"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/27593\/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=27593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=27593"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=27593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}