¡@

Home 

c# Programming Glossary: win32exception

Convert System.Drawing.Icon to System.Media.ImageSource

http://stackoverflow.com/questions/1127647/convert-system-drawing-icon-to-system-media-imagesource

if DeleteObject hBitmap throw new Win32Exception return wpfBitmap Then you can do ImageSource wpfBitmap img.ToImageSource..

How do I access ARP-protocol information through .NET?

http://stackoverflow.com/questions/1148778/how-do-i-access-arp-protocol-information-through-net

ERROR_INSUFFICIENT_BUFFER Throw an exception. throw new Win32Exception result Allocate the memory do it in a try finally block to.. an exception. if result 0 Throw an exception. throw new Win32Exception result Now we have the buffer we have to marshal it. We can..

How do I kill a process using Vb.NET or C#?

http://stackoverflow.com/questions/116090/how-do-i-kill-a-process-using-vb-net-or-c

try p.Kill p.WaitForExit possibly with a timeout catch Win32Exception winException process was terminating or can't be terminated..

Win32 API function to programmatically enable/disable device

http://stackoverflow.com/questions/1438371/win32-api-function-to-programmatically-enable-disable-device

sb.Capacity out requiredSize if result false throw new Win32Exception if instanceId.Equals sb.ToString return index not found.. @params Marshal.SizeOf @params if result false throw new Win32Exception result NativeMethods.SetupDiCallClassInstaller DiFunction.PropertyChange.. int SetupApiError.OnlyValidateViaAuthenticode throw new Win32Exception SetupAPI error SetupApiError err .ToString else throw new..

Windows 7 and Vista UAC - Programatically requesting elevation in C#

http://stackoverflow.com/questions/2282448/windows-7-and-vista-uac-programatically-requesting-elevation-in-c-sharp

fileName try Process.Start processInfo return true catch Win32Exception Do nothing. Probably the user canceled the UAC window return..

Accessing Password Protected Network Drives in Windows in C#?

http://stackoverflow.com/questions/2563724/accessing-password-protected-network-drives-in-windows-in-c

NativeMethods.LogonProvider.Default out token throw new Win32Exception try IntPtr tokenDuplicate if NativeMethods.DuplicateToken token.. out tokenDuplicate throw new Win32Exception try using WindowsImpersonationContext impersonationContext.. Uncomment if you need to know this case. throw new Win32Exception finally if token IntPtr.Zero if NativeMethods.CloseHandle..

Get timestamp from Authenticode Signed files in .NET

http://stackoverflow.com/questions/3281057/get-timestamp-from-authenticode-signed-files-in-net

ref certStore ref cryptMsg ref context throw new Win32Exception Marshal.GetLastWin32Error expecting contentType 10 CERT_QUERY_CONTENT_PKCS7_SIGNED_EMBED.. 0 IntPtr.Zero ref cbData throw new Win32Exception Marshal.GetLastWin32Error var vData new byte cbData Get the.. 0 vData ref cbData throw new Win32Exception Marshal.GetLastWin32Error var signedCms new SignedCms signedCms.Decode..

Using Process.Start() to start a process as a different user from within a Windows Service

http://stackoverflow.com/questions/362419/using-process-start-to-start-a-process-as-a-different-user-from-within-a-windo

IntPtr.Zero int x CloseHandle token if x 0 throw new Win32Exception Marshal.GetLastWin32Error x CloseHandle primaryToken if x.. x CloseHandle primaryToken if x 0 throw new Win32Exception Marshal.GetLastWin32Error The basic procedure is Log the user..

Get Size of file on disk

http://stackoverflow.com/questions/3750590/get-size-of-file-on-disk

bytesPerSector out dummy out dummy if result 0 throw new Win32Exception uint clusterSize sectorsPerCluster bytesPerSector uint hosize..

Access a Remote Directory from C#

http://stackoverflow.com/questions/5433570/access-a-remote-directory-from-c-sharp

credentials.UserName 0 if result 0 throw new Win32Exception result #endregion #region Events summary Occurs when this instance..