earlrainer
Programmer
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 & ":\Finance"
objFSO.CreateFolder(strDrive & ":\Finance\Logs"
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2"
Set objNewShare = objWMIService.Get("Win32_Share"
errReturn = objNewShare.Create(strDrive & ":\Finance", "FinanceShare", FILE_SHARE, _
MAXIMUM_CONNECTIONS, "Public share for the Finance group."
errReturn = objNewShare.Create(strDrive & ":\Finance\Logs", "FinanceShare", FILE_SHARE, _
MAXIMUM_CONNECTIONS, "Public share for the Finance group."
End If
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 & ":\Finance"
objFSO.CreateFolder(strDrive & ":\Finance\Logs"
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2"
Set objNewShare = objWMIService.Get("Win32_Share"
errReturn = objNewShare.Create(strDrive & ":\Finance", "FinanceShare", FILE_SHARE, _
MAXIMUM_CONNECTIONS, "Public share for the Finance group."
errReturn = objNewShare.Create(strDrive & ":\Finance\Logs", "FinanceShare", FILE_SHARE, _
MAXIMUM_CONNECTIONS, "Public share for the Finance group."
End If