ParsX.com
پذیرش پروژه از دانشجویی ... تا سازمانی 09376225339
 
   ProfileProfile   Log in to check your private messagesLog in to check your private messages  |  FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups Log inLog in   RegisterRegister 

تعداد ، نوع و اسم درایو های موجود در سیستم (بسیار کاربردی)

 
Post new topic   Reply to topic    ParsX.com Forum Index -> ويژوال بيسيك .NET
View previous topic :: View next topic  
Author Message
unknown
مدير بخش ويژوال بيسيك
مدير بخش ويژوال بيسيك


Joined: 05 Dec 2004
Posts: 439
Location: Tehran

PostPosted: Sat Jul 02, 2005 6:44 pm    Post subject: تعداد ، نوع و اسم درایو های موجود در سیستم (بسیار کاربردی) Reply with quote

فقط یک ListBox را روی فرمتان قرار دهید و کد زیر را در فرم کپی کنید
(این کد به درخواست آرش جان می باشد)


Private Const DRIVE_REMOVABLE = 2
Private Const DRIVE_FIXED = 3
Private Const DRIVE_REMOTE = 4
Private Const DRIVE_CDROM = 5
Private Const DRIVE_RAMDISK = 6
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long

Private Sub GetDrives(lst1 As ListBox)
'get available drives on computer
Dim strsave As String
Dim ret As Long
Dim i As Byte
Dim drive As String
strsave = String(255, Chr$(0))
ret = GetLogicalDriveStrings(255, strsave)
lst1.Clear
For i = 0 To 100
    If Left$(strsave, InStr(1, strsave, Chr$(0))) = Chr$(0) Then Exit For
        drive = Left$(strsave, InStr(1, strsave, Chr$(0)) - 1)
        strsave = Right$(strsave, Len(strsave) - InStr(1, strsave, Chr$(0)))
    Select Case GetDriveType(drive)
        Case DRIVE_REMOVABLE
            lst1.AddItem UCase$(drive) & vbTab & "(Removable Drive)"
        Case DRIVE_FIXED
            lst1.AddItem UCase$(drive) & vbTab & "(Fixed Drive)"
        Case DRIVE_REMOTE
            lst1.AddItem UCase$(drive) & vbTab & "(Remote Drive)"
        Case DRIVE_CDROM
            lst1.AddItem UCase$(drive) & vbTab & "(CDROM Drive)"
        Case DRIVE_RAMDISK
            lst1.AddItem UCase$(drive) & vbTab & "(RAM Disk)"
        Case Else
    End Select
Next i
lst1.ListIndex = 0
End Sub

Private Sub Form_Load()
GetDrives List1
End Sub
'Code Generated by Amir Moradabadi
Back to top
arash
مدير بخش سي
مدير بخش سي


Joined: 27 Nov 2004
Posts: 1232
Location: www.parsx.com

PostPosted: Sat Jul 02, 2005 9:19 pm    Post subject: Reply with quote

امیر جان تا حالا شده ماه ببینی
تو آینه بیشتر نگاه کن
راستی اون مشکل قفل کردن Task manager Xp رو استاد کن
Back to top
unknown
مدير بخش ويژوال بيسيك
مدير بخش ويژوال بيسيك


Joined: 05 Dec 2004
Posts: 439
Location: Tehran

PostPosted: Tue Jul 05, 2005 5:11 pm    Post subject: Reply with quote

استاد شد
Back to top
Display posts from previous:   
Post new topic   Reply to topic    ParsX.com Forum Index -> ويژوال بيسيك .NET All times are GMT + 3.5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum