Friday, September 3, 2010

About .Net

Hi
ALL
Would you like to share Knowledge in .Net
Ok
then
Lets Start......

1 comment:

Aniruddha Badawe said...

CD / DVD Tray Loker

To get this to work in .NET 4, you have to change the DLLImport signature.

[DllImport("kernel32.dll", SetLastError = true)]
private static extern IntPtr CreateFile(
string lpFileName,
uint dwDesiredAccess,
int dwShareMode,
ref SECURITY_ATTRIBUTES lpSecurityAttributes,
int dwCreationDisposition,
int dwFlagsAndAttributes,
IntPtr template);

Then change the usage to be this:

IntPtr deviceHandle = CreateFile(
fileName,
GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
ref securityAttributes,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
IntPtr.Zero);