Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert this vb code to delphi

Status
Not open for further replies.

earlrainer

Programmer
Mar 1, 2002
170
IN
Hi ,

can anyone convert the following VB code to delphi


Dim objFSO
Dim strDrive

Set objFSO = CreateObject("Scripting.FileSystemObject")

Const FILE_SHARE = 0
Const MAXIMUM_CONNECTIONS = 25

' local computer name
strComputer = "MyMachine"

' Ask drive to user
strDrive = InputBox("In which drive do you want to create the folders ?")

' Take the first character entered by the user (ex: C)
strDrive = UCase(Left(strDrive, 1))

' Check to see if it's a valid letter (From A to Z)
If Asc(strDrive) >= 65 And Asc(strDrive) <= 90 Then
objFSO.CreateFolder(strDrive & &quot;:\Finance&quot;)
objFSO.CreateFolder(strDrive & &quot;:\Finance\Logs&quot;)

Set objWMIService = GetObject(&quot;winmgmts:&quot; & &quot;{impersonationLevel=impersonate}!\\&quot; & strComputer & &quot;\root\cimv2&quot;)
Set objNewShare = objWMIService.Get(&quot;Win32_Share&quot;)
errReturn = objNewShare.Create(strDrive & &quot;:\Finance&quot;, &quot;FinanceShare&quot;, FILE_SHARE, _
MAXIMUM_CONNECTIONS, &quot;Public share for the Finance group.&quot;)
errReturn = objNewShare.Create(strDrive & &quot;:\Finance\Logs&quot;, &quot;FinanceShare&quot;, FILE_SHARE, _
MAXIMUM_CONNECTIONS, &quot;Public share for the Finance group.&quot;)
End If

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top