Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 347
Kredns Avatar asked Apr 09 '09 23:04

Kredns


3 Answers

There are lots of practical examples at http://pinvoke.net.

like image 57
i_am_jorf Avatar answered Oct 29 '22 17:10

i_am_jorf


Check out the P/Invoke Interop Assistant, as well. There's some great code there, and a very useful tool. It makes it much easier to learn.

like image 25
Reed Copsey Avatar answered Oct 29 '22 18:10

Reed Copsey


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.

EDIT

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.

like image 45
scottm Avatar answered Oct 29 '22 17:10

scottm