Click here to Skip to main content
15,906,333 members
Home / Discussions / C#
   

C#

 
GeneralRe: Space as string in user settings file Pin
cbutle3@netzero.com12-Oct-10 9:01
cbutle3@netzero.com12-Oct-10 9:01 
GeneralRe: Space as string in user settings file Pin
Ian Shlasko12-Oct-10 9:33
Ian Shlasko12-Oct-10 9:33 
AnswerRe: Space as string in user settings file [modified] Pin
PIEBALDconsult12-Oct-10 17:09
mvePIEBALDconsult12-Oct-10 17:09 
QuestionDataGridView Search [modified] Pin
boreland12-Oct-10 3:55
boreland12-Oct-10 3:55 
AnswerRe: DataGridView Search Pin
Luc Pattyn12-Oct-10 4:14
sitebuilderLuc Pattyn12-Oct-10 4:14 
GeneralRe: DataGridView Search Pin
boreland12-Oct-10 4:19
boreland12-Oct-10 4:19 
GeneralRe: DataGridView Search Pin
Luc Pattyn12-Oct-10 4:43
sitebuilderLuc Pattyn12-Oct-10 4:43 
GeneralRe: DataGridView Search Pin
boreland12-Oct-10 4:50
boreland12-Oct-10 4:50 
GeneralRe: DataGridView Search Pin
Luc Pattyn12-Oct-10 4:56
sitebuilderLuc Pattyn12-Oct-10 4:56 
AnswerRe: DataGridView Search Pin
boreland12-Oct-10 16:04
boreland12-Oct-10 16:04 
QuestionHow to create a DataSet with two tables having a 'JOIN' in ADO.NET? Pin
PravinSingh12-Oct-10 2:14
PravinSingh12-Oct-10 2:14 
AnswerRe: How to create a DataSet with two tables having a 'JOIN' in ADO.NET? Pin
OriginalGriff12-Oct-10 2:23
mveOriginalGriff12-Oct-10 2:23 
GeneralRe: How to create a DataSet with two tables having a 'JOIN' in ADO.NET? Pin
PravinSingh12-Oct-10 3:57
PravinSingh12-Oct-10 3:57 
GeneralRe: How to create a DataSet with two tables having a 'JOIN' in ADO.NET? Pin
MKAdeel12-Oct-10 23:48
MKAdeel12-Oct-10 23:48 
GeneralRe: How to create a DataSet with two tables having a 'JOIN' in ADO.NET? Pin
Pete O'Hanlon13-Oct-10 0:59
mvePete O'Hanlon13-Oct-10 0:59 
QuestionRe: How to create a DataSet with two tables having a 'JOIN' in ADO.NET? Pin
PravinSingh13-Oct-10 7:20
PravinSingh13-Oct-10 7:20 
AnswerRe: How to create a DataSet with two tables having a 'JOIN' in ADO.NET? Pin
fjdiewornncalwe12-Oct-10 2:48
professionalfjdiewornncalwe12-Oct-10 2:48 
AnswerRe: How to create a DataSet with two tables having a 'JOIN' in ADO.NET? Pin
PIEBALDconsult12-Oct-10 3:34
mvePIEBALDconsult12-Oct-10 3:34 
AnswerRe: How to create a DataSet with two tables having a 'JOIN' in ADO.NET? Pin
T M Gray12-Oct-10 8:16
T M Gray12-Oct-10 8:16 
GeneralRe: How to create a DataSet with two tables having a 'JOIN' in ADO.NET? Pin
PIEBALDconsult12-Oct-10 17:15
mvePIEBALDconsult12-Oct-10 17:15 
Questionhow to findout which drive is a cool disk? Pin
Fred 3412-Oct-10 1:40
Fred 3412-Oct-10 1:40 
AnswerRe: how to findout which drive is a cool disk? Pin
Luc Pattyn12-Oct-10 1:52
sitebuilderLuc Pattyn12-Oct-10 1:52 
Hi,

I know three ways to get some information on physical devices:

1.
using the DriveInfo class

2.
using WMI, have a look at the WMI classes Win32_DiskDrive, Win32_LogicalDiskToPartition, Win32_PhysicalMedia, Win32_CDROMDrive; which ones you want depends on the information you need.
warning: not everything may be available to regular users under Vista/Win7 without going trough the UAC dialog.

3.
using Win32 functions (from kernel32.dll), which requires P/Invoke. Here is an example prototype:
/// <summary>
/// Gets the drive type
/// </summary>
/// <param name="rootPathName">drive name (letter colon backslash)</param>
/// <returns>
/// 0 (DRIVE_UNKNOWN) The drive type cannot be determined.
/// 1 (DRIVE_NO_ROOT_DIR) The root path is invalid. (no volume is mounted at the path).
/// 2 (DRIVE_REMOVABLE) The disk can be removed from the drive.
/// 3 (DRIVE_FIXED) The disk cannot be removed from the drive.
/// 4 (DRIVE_REMOTE) The drive is a remote (network) drive.
/// 5 (DRIVE_CDROM) The drive is a CD-ROM drive.
/// 6 (DRIVE_RAMDISK) The drive is a RAM disk.
/// </returns>
[DllImport("kernel32.dll")]
public static extern int GetDriveType(string rootPathName);


For each of these, I refer to the MSDN documentation, Google, and some experimentation.

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.


QuestionBlock Desktop to prevent user interaction Pin
teknolog12311-Oct-10 23:03
teknolog12311-Oct-10 23:03 
AnswerRe: Block Desktop to prevent user interaction Pin
Luc Pattyn11-Oct-10 23:41
sitebuilderLuc Pattyn11-Oct-10 23:41 
GeneralRe: Block Desktop to prevent user interaction Pin
teknolog12312-Oct-10 0:37
teknolog12312-Oct-10 0:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.