C# – P/Invoke tutorials


Does anyone know of a good tutorial/e-book that goes in depth on the System.Runtime.InteropServices namespace? I just got through reading this tutorial on how to make the UAC shield show up in a button and now I really want to learn this.

P.S. How do look in the windows system files to know that a method exist to show a UAC shield in a button?

Best Solution

As for your p.s., the code you need is in the information you provided. You use the SendMessage method to send the BCM_SETSHIELD message to a handle (in this case, the handle of your button) that should show it.


pinvoke.net is a good place to get the prototypes of native functions, but if you don't know what you are looking for, it's not the best. I would suggest the Windows API reference section of MSDN. You can browse functions in alphabetical order, by category, and by Windows Release, all with descriptions of what they do, what they return and the flag options that control their actions.

Related Question