Windows code snippets (142)
How to get bus info
Published: 12. February 2012 | Updated: 12. February 2012Categories: Hardware
Tags: C# Hardware Windows WMI
How to get BIOS info
Published: 12. February 2012 | Updated: 12. February 2012Categories: Windows
Tags: C# Windows WMI
How to enumerate computer temperature sensors
Published: 12. February 2012 | Updated: 12. February 2012Categories: Hardware
Tags: C# Hardware Windows WMI
How to enumerate motherboard devices
Published: 12. February 2012 | Updated: 12. February 2012Categories: Hardware
Tags: C# Hardware Windows WMI
How to enumerate memory devices using WMI
Published: 12. February 2012 | Updated: 12. February 2012Categories: Hardware
Tags: C# Hardware Windows WMI
How to enumerate windows services
Published: 12. February 2012 | Updated: 12. February 2012Categories: Services
Tags: C# Services Windows WMI
How to enumerate desktops using WMI
Published: 12. February 2012 | Updated: 12. February 2012Categories: Windows
Tags: C# Windows WMI
How to enumerate batteries using WMI
Published: 12. February 2012 | Updated: 12. February 2012Categories: Hardware
Tags: C# Hardware Windows WMI
How to enumerate cdrom drives
Published: 12. February 2012 | Updated: 12. February 2012Categories: Hardware
Tags: C# Hardware Windows WMI
How to enumerate page files
Published: 12. February 2012 | Updated: 12. February 2012Categories: Windows
Tags: C# Windows WMI
How to enumerate patches using WMI
Published: 12. February 2012 | Updated: 12. February 2012Categories: Windows
Tags: C# Windows WMI
How to enumerate windows groups
Published: 12. February 2012 | Updated: 12. February 2012Categories: Windows
Tags: C# Windows WMI
How to enumerate disk partitions
Published: 12. February 2012 | Updated: 12. February 2012Categories: Hardware
Tags: C# Hardware Windows WMI
How to enumerate all directories in computer
Published: 12. February 2012 | Updated: 12. February 2012Categories: Directories Windows
Tags: C# File System Win32 Windows WMI
How to enumerate monitors using WMI
Published: 12. February 2012 | Updated: 12. February 2012Categories: Hardware
Tags: C# Hardware Windows WMI
How to enumerate installed audio/video codecs
Published: 12. February 2012 | Updated: 12. February 2012Categories: Windows
Tags: C# Media Win32 Windows WMI
How to enumerate system drivers
Published: 12. February 2012 | Updated: 12. February 2012Categories: Hardware
Tags: C# Hardware Windows WMI
How to enumerate physical media
Published: 12. February 2012 | Updated: 12. February 2012Categories: Hardware
Tags: C# Hardware Windows WMI
How to enumerate keyboards
Published: 12. February 2012 | Updated: 12. February 2012Categories: Hardware
Tags: C# Hardware Windows WMI
How to enumerate windows threads
Published: 12. February 2012 | Updated: 12. February 2012Categories: Windows
Tags: C# Threading Win32 Windows WMI
How to enumerate system volumes
Published: 8. February 2012 | Updated: 8. February 2012Categories: Windows
Tags: C# Win32 Windows WMI
How to enumerate processors
Published: 8. February 2012 | Updated: 8. February 2012Categories: Hardware
Tags: C# Hardware Windows WMI
How to get running processes info
Published: 8. February 2012 | Updated: 8. February 2012Categories: Processes
Tags: C# Win32 Windows WMI
How to enumerate disk drives
Published: 8. February 2012 | Updated: 8. February 2012Categories: Hardware
Tags: C# Hardware Windows WMI
How to enumerate available printers
Published: 8. February 2012 | Updated: 8. February 2012Categories: Hardware
Tags: C# Hardware Windows WMI
How to enumerate sound devices
Published: 7. February 2012 | Updated: 7. February 2012Categories: Hardware
Tags: C# Hardware Windows WMI
How to get active window handle and title
Published: 7. February 2012 | Updated: 7. February 2012Categories: Win32 Windows
Tags: C# UI Win32 Windows
How to get installed software info
Published: 7. February 2012 | Updated: 7. February 2012Categories: Windows
Tags: C# Win32 Windows WMI
How to open message box
Published: 1. February 2012 | Updated: 1. February 2012Categories: Winforms WPF
Tags: C# UI Windows Winforms WPF
How to check that event log exists
Published: 1. February 2012 | Updated: 1. February 2012Categories: Debug Windows
Tags: C# Debug Windows
How to request for administrator permissions
Published: 31. January 2012 | Updated: 31. January 2012Categories: Windows
Tags: C# Security Windows
How to get domain controllers
Published: 31. January 2012 | Updated: 31. January 2012Categories: Network
Tags: C# Network Windows
How to open Folder Options window
Published: 31. January 2012 | Updated: 31. January 2012Categories: Win32 Windows
Tags: C# Win32 Windows
How to get computer user account names
Published: 31. January 2012 | Updated: 31. January 2012Categories: Windows
Tags: C# Windows WMI
How to enumerate local network computers using Active Directory
Published: 31. January 2012 | Updated: 31. January 2012Categories: Network
Tags: C# Network Windows
How to delete readonly file
Published: 30. November 2011 | Updated: 30. November 2011Categories: Files
Tags: C# File System Windows
How to get windows that are in taskbar
Published: 23. November 2011 | Updated: 23. November 2011Categories: Windows
Tags: C# Windows
How to get handle of WPF window
Published: 23. November 2011 | Updated: 23. November 2011Categories: WPF
Tags: C# Windows WPF
How to get battery information
Published: 20. November 2011 | Updated: 20. November 2011Categories: Hardware
Tags: C# Hardware Windows Winforms
How to find out whether pc is slow machine
Published: 19. November 2011 | Updated: 19. November 2011Categories: Hardware
Tags: C# Hardware Windows WPF
How to find out whether pc is tablet
Published: 19. November 2011 | Updated: 19. November 2011Categories: Windows WPF
Tags: C# Windows WPF
How to find out whether Windows UI effects are enabled
Published: 19. November 2011 | Updated: 19. November 2011Categories: Windows
Tags: C# UI Windows Winforms WPF
How to find out whether program is running in a remote session
Published: 19. November 2011 | Updated: 19. November 2011Categories: Win32 Windows
Tags: C# Win32 Windows Winforms WPF
How to change cursor
Published: 14. December 2008 | Updated: 10. November 2011Categories: Winforms
Tags: C# UI Windows Winforms
How to write message to EventLog
Published: 13. December 2008 | Updated: 10. November 2011Categories: Debug Windows
Tags: C# Debug Windows
How to calculate file checksum
Published: 4. November 2011 | Updated: 4. November 2011Categories: Files Security
Tags: C# File System Security Windows
How to lock a file
Published: 9. October 2011 | Updated: 31. October 2011Categories: Windows
Tags: C# File System Windows
How to determine 32/64-bit system
Published: 16. January 2009 | Updated: 31. October 2011Categories: Windows
Tags: C# Windows
How to kill process by name
Published: 5. January 2009 | Updated: 27. October 2011Categories: Processes
Tags: C# Windows
How to enumerate event log entries
Published: 12. January 2009 | Updated: 27. October 2011Categories: Debug Windows
Tags: C# Debug Windows
How to get information about all monitors
Published: 27. October 2011 | Updated: 27. October 2011Categories: Hardware
Tags: C# Hardware Windows Winforms
How to get monitors count
Published: 27. October 2011 | Updated: 27. October 2011Categories: Hardware
Tags: C# Hardware Windows Winforms
How to launch custom process
Published: 13. December 2008 | Updated: 27. October 2011Categories: Processes
Tags: C# Windows Winforms
How to get operating system info
Published: 5. January 2009 | Updated: 27. October 2011Categories: Windows
Tags: C# Windows
How to write a windows registry key
Published: 13. December 2008 | Updated: 26. October 2011Categories: Registry
Tags: C# Windows
How to read a windows registry key
Published: 13. December 2008 | Updated: 26. October 2011Categories: Registry
Tags: C# Windows Winforms
How to delete a windows registry key
Published: 12. January 2009 | Updated: 26. October 2011Categories: Registry
Tags: C# Windows
How to get current Windows user
Published: 13. December 2008 | Updated: 26. October 2011Categories: Authorization
Tags: C# Security Windows Winforms
How to find out whether current user is in specific role
Published: 14. October 2011 | Updated: 26. October 2011Categories: Authorization
Tags: Authorization C# Windows
How to find out whether current user is administrator
Published: 14. October 2011 | Updated: 26. October 2011Categories: Authorization
Tags: Authorization C# Windows
How to find out whether windows user is authenticated
Published: 14. October 2011 | Updated: 26. October 2011Categories: Authorization
Tags: Authorization C# Windows
How to find out whether current user is anonymous
Published: 14. October 2011 | Updated: 26. October 2011Categories: Authorization
Tags: Authorization C# Windows
How to find out whether current user is guest
Published: 14. October 2011 | Updated: 26. October 2011Categories: Authorization
Tags: Authorization C# Windows
How to find out whether current user is system
Published: 14. October 2011 | Updated: 26. October 2011Categories: Authorization
Tags: Authorization C# Windows
How to enumerate serial ports
Published: 8. January 2009 | Updated: 26. October 2011Categories: Hardware Network
Tags: C# Hardware Network Windows
How to get disk free space
Published: 12. January 2009 | Updated: 26. October 2011Categories: File system Hardware
Tags: C# File System Hardware Windows
How to get processors count
Published: 9. October 2011 | Updated: 26. October 2011Categories: Hardware
Tags: C# Hardware Windows
How to get screen size
Published: 12. January 2009 | Updated: 26. October 2011Categories: GDI Hardware
Tags: C# GDI Hardware Windows Winforms
How to get mac address
Published: 9. October 2011 | Updated: 26. October 2011Categories: Hardware Network
Tags: C# Hardware Network Windows
How to list process threads
Published: 9. October 2011 | Updated: 26. October 2011Categories: Processes
Tags: C# Threading Windows
How to open url address in browser
Published: 13. December 2008 | Updated: 26. October 2011Categories: Network Processes
Tags: C# Network Windows Winforms
How to open pdf using Acrobat Reader
Published: 9. October 2011 | Updated: 26. October 2011Categories: Processes
Tags: C# Windows
How to get process ID
Published: 14. October 2011 | Updated: 26. October 2011Categories: Processes
Tags: C# Windows
How to list all running processes
Published: 9. October 2011 | Updated: 26. October 2011Categories: Processes
Tags: C# Windows
How to get current process
Published: 13. December 2008 | Updated: 26. October 2011Categories: Processes
Tags: C# Windows Winforms
How to get DateTime from Windows file time
Published: 24. October 2011 | Updated: 26. October 2011Categories: DateTime
Tags: C# Conversion DateTime File System Serialization Windows
How to convert DateTime to Windows file time
Published: 24. October 2011 | Updated: 26. October 2011Categories: DateTime
Tags: C# Conversion DateTime File System Serialization Windows
How to get/set file creation, last access or write date-time
Published: 25. October 2011 | Updated: 26. October 2011Categories: Files
Tags: C# DateTime Windows
How to get/set directory creation, last access or write date-time
Published: 26. October 2011 | Updated: 26. October 2011Categories: Directories
Tags: C# Windows
How to get content of directory
Published: 13. December 2008 | Updated: 26. October 2011Categories: Directories File system
Tags: C# Windows
How to check that file exists
Published: 13. December 2008 | Updated: 26. October 2011Categories: Files
Tags: C# Windows
How to check that directory exists
Published: 26. October 2011 | Updated: 26. October 2011Categories: Directories
Tags: C# Windows
How to set file attributes
Published: 25. October 2011 | Updated: 25. October 2011Categories: Files
Tags: C# Windows
How to set file to hidden
Published: 25. October 2011 | Updated: 25. October 2011Categories: Files
Tags: C# Windows
How to get file attributes
Published: 25. October 2011 | Updated: 25. October 2011Categories: Files
Tags: C# Windows
How to set file to ReadOnly state
Published: 9. October 2011 | Updated: 25. October 2011Categories: File system Windows
Tags: C# File System Windows
How to generate random file name
Published: 25. October 2011 | Updated: 25. October 2011Categories: File system
Tags: C# Windows
How to get thread id
Published: 25. October 2011 | Updated: 25. October 2011Categories: Win32
Tags: C# Threading Win32 Windows
How to get system colors
Published: 24. October 2011 | Updated: 24. October 2011Categories: Windows
Tags: C# Colors Windows Winforms WPF
How to change colors in console application
Published: 8. January 2009 | Updated: 13. October 2011Categories: Windows
Tags: C# Windows
How to hide form from taskbar and Alt+TAB
Published: 22. January 2009 | Updated: 12. October 2011Categories: Winforms
Tags: C# Windows Winforms
How to get Windows country/region name
Published: 11. October 2011 | Updated: 11. October 2011Categories: Regions
Tags: C# Globalization Windows
How to get desktop path
Published: 9. October 2011 | Updated: 9. October 2011Categories: Windows
Tags: C# Windows
How to get network domain name
Published: 9. October 2011 | Updated: 9. October 2011Categories: Network
Tags: C# Network Windows
How to get .NET version
Published: 9. October 2011 | Updated: 9. October 2011Categories: Framework
Tags: C# Windows
How to get name of the computer
Published: 9. October 2011 | Updated: 9. October 2011Categories: Windows
Tags: C# Windows
How to convert SecureString to string
Published: 30. September 2011 | Updated: 30. September 2011Categories: Converting Security
Tags: C# Security Text Windows
How to truncate file path
Published: 27. January 2009 | Updated: 26. September 2011Categories: File system Win32
Tags: C# File System Win32 Windows
How to detect save mode in Windows
Published: 26. January 2009 | Updated: 26. September 2011Categories: Windows
Tags: C# Windows Winforms
How to convert handle to form
Published: 15. January 2009 | Updated: 26. September 2011Categories: Unsafe Code Winforms
Tags: C# Controls Windows Winforms
How to clear recent documents
Published: 27. January 2009 | Updated: 26. September 2011Categories: File system Win32
Tags: C# Win32 Windows
How to add file to recent documents
Published: 27. January 2009 | Updated: 26. September 2011Categories: Files Win32
Tags: C# Win32 Windows
How to get status of windows service
Published: 26. January 2009 | Updated: 26. September 2011Categories: Services
Tags: C# Services Windows
How to show/hide mouse cursor
Published: 22. January 2009 | Updated: 22. January 2009Categories: Winforms
Tags: C# Windows Winforms
How to get file name from path
Published: 22. January 2009 | Updated: 22. January 2009Categories: Files
Tags: C# File System Windows
How to send email using default mail client
Published: 22. January 2009 | Updated: 22. January 2009Categories: Network
Tags: C# Network Windows Winforms
How to enumerate network interfaces
Published: 22. January 2009 | Updated: 22. January 2009Categories: Network
Tags: C# Network Windows
How to choose folder using FolderBrowserDialog
Published: 21. January 2009 | Updated: 21. January 2009Categories: Directories Winforms
Tags: C# Windows Winforms
How to get installed fonts
Published: 20. January 2009 | Updated: 20. January 2009Categories: Windows
Tags: C# Text Windows
How to continue a windows service
Published: 12. January 2009 | Updated: 12. January 2009Categories: Services
Tags: C# Services Windows
How to pause a windows service
Published: 12. January 2009 | Updated: 12. January 2009Categories: Services
Tags: C# Services Windows
How to stop a windows service
Published: 12. January 2009 | Updated: 12. January 2009Categories: Services
Tags: C# Services Windows
How to start a windows service
Published: 12. January 2009 | Updated: 12. January 2009Categories: Services
Tags: C# Services Windows
How to get list of services
Published: 12. January 2009 | Updated: 12. January 2009Categories: Services
Tags: C# Services Windows
How to get system information
Published: 12. January 2009 | Updated: 12. January 2009Categories: Windows
Tags: C# Windows
How to get system directory
Published: 12. January 2009 | Updated: 12. January 2009Categories: Windows
Tags: C# File System Windows
How to set environment variable
Published: 12. January 2009 | Updated: 12. January 2009Categories: Windows
Tags: C# Windows
How to get path to windows special folders
Published: 8. January 2009 | Updated: 8. January 2009Categories: Windows
Tags: C# File System Windows
How to get file size
Published: 8. January 2009 | Updated: 8. January 2009Categories: Files
Tags: C# File System Windows
How to copy directory
Published: 8. January 2009 | Updated: 8. January 2009Categories: Directories
Tags: C# File System Windows
How to determine network connection availability
Published: 8. January 2009 | Updated: 8. January 2009Categories: Network
Tags: C# Network Windows
How to send keys to application
Published: 8. January 2009 | Updated: 8. January 2009Categories: Winforms
Tags: C# Windows Winforms
How to get output from console application
Published: 8. January 2009 | Updated: 8. January 2009Categories: Consoles
Tags: C# Windows Console
How to stop playing background sound
Published: 8. January 2009 | Updated: 8. January 2009Categories: Winforms
Tags: C# Media Windows Winforms
How to play sound in C#
Published: 8. January 2009 | Updated: 8. January 2009Categories: Winforms
Tags: C# Media Windows Winforms
How to get image from clipboard
Published: 8. January 2009 | Updated: 8. January 2009Categories: GDI Windows
Tags: C# GDI Windows Winforms
How to create temporary file
Published: 5. January 2009 | Updated: 5. January 2009Categories: Files
Tags: C# File System Windows
How to protect data using user or machine credentials
Published: 5. January 2009 | Updated: 5. January 2009Categories: Encryption Windows
Tags: C# Security Text Windows
How to get environment variables
Published: 5. January 2009 | Updated: 5. January 2009Categories: Framework Windows
Tags: C# Windows
How to write bytes to file
Published: 22. December 2008 | Updated: 22. December 2008Categories: Files
Tags: C# File System Windows
How to move file
Published: 21. December 2008 | Updated: 21. December 2008Categories: Files
Tags: C# File System Windows
How to copy file
Published: 21. December 2008 | Updated: 21. December 2008Categories: Files
Tags: C# File System Windows
How to flash form taskbar button
Published: 21. December 2008 | Updated: 21. December 2008Categories: Win32 Winforms
Tags: C# UI Win32 Windows Winforms
How to delete files or folder to Recycle Bin
Published: 14. December 2008 | Updated: 21. December 2008Categories: Windows File system
Tags: C# File System Windows
How to delete file
Published: 21. December 2008 | Updated: 21. December 2008Categories: Files
Tags: C# File System Windows
How to use console output in winforms
Published: 15. December 2008 | Updated: 20. December 2008Categories: Win32 Winforms
Tags: C# Console Win32 Windows Winforms
How to create screenshot using C#
Published: 13. December 2008 | Updated: 20. December 2008Categories: GDI Windows
Tags: C# GDI Windows
How to encrypt / decrypt file for current Windows user
Published: 16. December 2008 | Updated: 16. December 2008Categories: Encryption Files
Tags: C# File System Security Windows
How to read file as bytes
Published: 16. December 2008 | Updated: 16. December 2008Categories: Files
Tags: C# File System Windows
How to get file extension
Published: 15. December 2008 | Updated: 15. December 2008Categories: Files
Tags: C# File System Text Windows
How to disable close 'x' button in winform
Published: 15. December 2008 | Updated: 15. December 2008Categories: Win32 Winforms
Tags: C# UI Windows Winforms
How to get drives
Published: 13. December 2008 | Updated: 13. December 2008Categories: File system Hardware
Tags: C# File System Hardware Windows





