This article explains how I modified the MSDN article's code so that it can be used to retrieve icons as a stand-alone class in the form of the IconReader type, and then the IconListManager type which can be used to maintain ImageLists of file icons. I personally found it quite hard to incorporate the MSDN code in my own application and after a few hours of wrestling with the masses of code and still getting errors when trying to build my own project I decided I would try and build up some classes around the Shell32 and User32 wrapped functions that I could use myself.Īfter looking back at the MSDN article the architecture of my solution and theirs is pretty similar, however I found it easier to develop my own classes and incorporate them into my own project. The code was left largely unchanged from the original article, although only SHGetFileInfo and DestroyIcon were retained. To call C-style functions exported from an unmanaged library, such as the Microsoft Windows® Shell32 API, you use the Platform Invocation Services (PInvoke)." They are not wrapped automatically because information about the parameters required by the function is not as rich as the information provided by a COM type library. NET Framework.Ĭ-style functions exported from an unmanaged library are a different matter. The majority of the marshalling work is handled automatically by the. NET Framework is handled via a proxy called the Runtime Callable Wrapper (RCW). "Interoperability with interfaces exposed by COM objects and the. The MSDN article explains how functions from Shell32 and User32 were wrapped in detail, but here's a short clip from the article: This article and classes are the result of my attempts to use the MSDN code in my own application. Included in part of the CRC Rich Client is support for file icons, something I wanted to do myself. This article is based upon code from the MSDN Cold Rooster Consulting case study.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |