Hosting Control Panel Applets using C#/C++

Wrapping Up

Time to go download the code, and perhaps toss me a vote so I know how to improve for the next article

Well it's time that you downloaded the source and demo projects if you haven't done so already. Nothing feels quite as good as running a project and seeing some results. So go have fun playing with the project and stepping around through some interesting coding ideas. I hope this helps some of you overcome some similar hurdles. I had a lot of fun writing the code and almost as much fun trying to explain it in this article. This is my official first posting online, probably will have many more, just gotta find the time. I've held back for sooooo long on posting from lack of time, not lack of ideas or knowledge. Look for more posts in the future.

Also, this being my first article, if you don't mind, give me some feedback, and possibly a vote. Have some kindness on my writing abilities as an author of articles, because as you may know I write code, not books. So chances are high that the article reads poorly, but hopefully the code is solid! :)

A quick peak at the Applet Viewer Window displaying the applets in large icon mode.

Now viewing in details view. Notice the name and description displayed for each applet.

And finally notice an applet that has just been launched by double clicking its icon. This demonstrates the applets are really being hosted by the applet engine.

What we learned

Let's review a few interesting concepts that we've covered:

  • Calling unmanaged function pointers
  • Dynamically loading unmanaged libraries at runtime
  • Acquiring function pointers to unmanaged functions
  • Translating C/C++ structures and data types to CLR compliant code
  • Finding alternatives to unsafe code for the purposes of using sizeof
  • Allocating/deallocating memory on the stack
  • Understanding how applets can be manipulated programmatically
  • Extracting strings and icons from embedded resources located in external unmanaged libraries

Things left, and known issues

  • Thread calls to Open and Close, or make Asynchronous wrappers
  • Figure out why certain applets return false after they close
  • Find out where in the heck the Admin Tools Applets are located or how they are inserted into the control panel namespace (I think it's a Shell Extension, just haven't found it yet)
  • Figure out how to work Marshal.GetUnmanagedThunkForManagedMethodPtr
  • Figure out how to convert MAKEINTRESOURCE to C#

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There are only two kinds of languages: the ones people complain about and the ones nobody uses” - Bjarne Stroustrup