{"id":165,"date":"2007-03-21T18:13:36","date_gmt":"2007-03-21T17:13:36","guid":{"rendered":"http:\/\/www.itwriting.com\/blog\/?p=165"},"modified":"2007-03-21T18:13:36","modified_gmt":"2007-03-21T17:13:36","slug":"semi-documented-apis-in-windows","status":"publish","type":"post","link":"https:\/\/www.itwriting.com\/blog\/165-semi-documented-apis-in-windows.html","title":{"rendered":"Semi-documented APIs in Windows"},"content":{"rendered":"<p>There have long been complaints about undocumented functions in the Windows API which give Microsoft&#8217;s internal developers an advantage over third-party software developers. Perhaps even more frustrating are those that are semi-documented. An example was found recently by&nbsp;a user of the <a href=\"http:\/\/www.itwriting.com\/htmleditor\/index.php\" target=\"_blank\">htmleditor<\/a>, a .NET wrapper for the HTML editor built into Internet Explorer. If you write an editor you might want to support undo and redo; there are simple undo and redo commands available but they are crude. The API also provides more advanced functions, including a change log and the ability to undo or redo entries in the log. You can find the&nbsp;<a href=\"http:\/\/msdn.microsoft.com\/library\/default.asp?url=\/workshop\/browser\/mshtml\/reference\/mshtml_editing_ref_entry.asp\" target=\"_blank\">documentation here<\/a>; the relevant interfaces are IHTMLChangeLog, IHTMLChangePlayback and IHTMLChangeSink.<\/p>\n<p>All looks good on a brief inspection; but note the lack of any sample code. Then think about how you might want to use this API. What exactly does an item in the change log represent &#8211; a single character, an HTML element, a paste operation, or what? How can you inspect the items (they seem to be a&nbsp;binary black box, understood only by an API function called ExecChange)?&nbsp;There is&nbsp;only one function for iterating through a change log, called GetNextChange &#8211; are you intended to cache the entries somewhere, since there is no GetPreviousChange or GetFirstChange?&nbsp;The API allows for notification of changes, but the Notify event has no arguments: presumably you are meant to call GetNextChange and do something or other with the log entry.<\/p>\n<p>Of course developers have shrugged their shoulders and experimented a bit. Some have found Notify failing to fire, particularly with MFC. Others have just been puzzled. I tried it with my C# wrapper and got strange results; I think the only way forward would be to reverse-engineer the log entries to work out what it is they represent.<\/p>\n<p>But what about Microsoft&#8217;s developer support? There are managed newsgroups, which are meant to guarantee a response for developers with MSDN subscriptions, as well as other online forums supposedly monitored by Microsoft developers &#8211; like Senior Program Manager Dave Massy, who says in <a href=\"http:\/\/forums.microsoft.com\/MSDN\/ShowPost.aspx?PostID=682982&amp;SiteID=1\" target=\"_blank\">his welcome<\/a>:<\/p>\n<blockquote>\n<p>Welcome to the MSDN forum for Internet Explorer Addon Development. If you have questions around development of extensions for Internet Explorer then this is the place to ask them.<\/p>\n<\/blockquote>\n<p>Perhaps it is; but Massy is strangely silent on the <a href=\"http:\/\/forums.microsoft.com\/MSDN\/ShowPost.aspx?PostID=1309313&amp;SiteID=1\" target=\"_blank\">intricacies of IHTMLChangeSink<\/a>. I have seen this often: easy questions get a ready reponse either from Microsoft or from community members, but the tough ones, where&nbsp;only Microsoft has the answer, are simply ignored; or else there is a request for further information which&nbsp;looks promising at first but&nbsp;leads nowhere. Try Googling on this API; you will find questions but few answers.<\/p>\n<p>My question is this: why bother publishing the&nbsp;API at all if it is so poorly documented and badly supported that nobody can figure out how to use it?<\/p>\n<p>I would guess that this&nbsp;API is or has been used internally, by&nbsp;other Microsoft products that use the IE editor, and that somewhere in the bowels of Redmond there is proper&nbsp;documentation or sample code, perhaps not in sufficiently polished form for general release.<\/p>\n<p>It&#8217;s time Microsoft either stopped pretending to offer developer support through these online forums, or put in the effort required to make them work.<\/p>\n<p>&nbsp;<\/p>\n<div class=\"wlWriterSmartContent\" id=\"0767317B-992E-4b12-91E0-4F059A8CECA8:631ce225-90fe-4676-8b03-74c249f234dc\" contenteditable=\"false\" style=\"padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px\">Technorati tags: <a href=\"http:\/\/technorati.com\/tags\/microsoft\" rel=\"tag\">microsoft<\/a>, <a href=\"http:\/\/technorati.com\/tags\/windows\" rel=\"tag\">windows<\/a>, <a href=\"http:\/\/technorati.com\/tags\/ie\" rel=\"tag\">ie<\/a>, <a href=\"http:\/\/technorati.com\/tags\/mshtml\" rel=\"tag\">mshtml<\/a>, <a href=\"http:\/\/technorati.com\/tags\/internet%20explorer\" rel=\"tag\">internet explorer<\/a>, <a href=\"http:\/\/technorati.com\/tags\/windows%20API\" rel=\"tag\">windows API<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>There have long been complaints about undocumented functions in the Windows API which give Microsoft&#8217;s internal developers an advantage over third-party software developers. Perhaps even more frustrating are those that are semi-documented. An example was found recently by&nbsp;a user of the htmleditor, a .NET wrapper for the HTML editor built into Internet Explorer. If you &hellip; <a href=\"https:\/\/www.itwriting.com\/blog\/165-semi-documented-apis-in-windows.html\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Semi-documented APIs in Windows<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[80,97],"tags":[],"class_list":["post-165","post","type-post","status-publish","format-standard","hentry","category-software-development","category-windows"],"_links":{"self":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts\/165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/comments?post=165"}],"version-history":[{"count":0,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts\/165\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/media?parent=165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/categories?post=165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/tags?post=165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}