pInvoke

Silverlight 5 pInvoke USB/Removable Drive detector

Original post: http://www.netusup.com/2011/12/31/silverlight-5-pinvoke-usbremovable-drive-detector/ Hi, A friend of mine asked me if an elevated trust Silverlight 5 application could monitor windows events, specifically when a USB drive is inserted or removed. I naturally said YES, knowing that pInvoke is supported, but decided to take a few moments to write some code. After searching the web I [...]

Tags: , ,

Posted in Uncategorized | No Comments »

Silverlight 5 (OOB) Win32 API GetLogicalDriveStrings

Hi, Starting to use Silverlight 5 and enjoying P/Invoke! We needed the ability to list drive letters on the user’s computer. Using System.Runtime.InteropServices, we imported the GetLogicalDriveStrings method. Then we created our own GetLogicalDrives() method which extracts the drive letters from the buffer that is returned. Here’s the code: using System.Runtime.InteropServices; using System.Windows; using System.Windows.Controls; [...]

Tags: , ,

Posted in Uncategorized | No Comments »