Create Domain With VB

April 17, 2008

Private Sub Check1_Click()
If Check1.Value = 1 Then
lblDomainName.Visible = True
txtDomainName.Visible = True
End If
If Check1.Value = 0 Then
lblDomainName.Visible = False
txtDomainName.Visible = False
End If
End Sub

Private Sub cmdGenerate_Click()
Dim responce
        Dim i As Integer
If Check1.Value = 1 Then
responce = MsgBox(”Do you want to create ” & txtDomainName.Text & ” DOMAIN user”, vbYesNo)
    If responce = vbYes Then

        For i = Val(txtUserStart.Text) To Val(txtUserEnd.Text)
            Shell “net user ” & txtUserPrefix & Format(i, “0000″) & txtUserPostfix & ” ” & txtPassPrefix & Format(i, “0000″) & txtPassPostfix & ” /ADD ” & txtDomainName.Text & ” /DOMAIN”, vbHide
        Next i
    End If
Else
responce = MsgBox(”Do you want to create LOCAL user”, vbYesNo)
    If responce = vbYes Then

        For i = Val(txtUserStart.Text) To Val(txtUserEnd.Text)
            Shell “net user ” & txtUserPrefix & Format(i, “0000″) & txtUserPostfix & ” ” & txtPassPrefix & Format(i, “0000″) & txtPassPostfix & ” /ADD”, vbHide
        Next i
    End If
End If
End Sub

Private Sub Label11_Click()

End Sub

Private Sub txtUserEnd_Change()
txtPassEnd.Text = txtUserEnd.Text
End Sub

Private Sub txtUserStart_Change()
txtPassStart.Text = txtUserStart.Text
End Sub

Copy File

April 17, 2008

Private Declare Function SHFileOperation Lib “Shell32.dll” Alias “SHFOperationA” (lpFileOp As SHFILEopstruct) As Long
Private Const FO_Copy = &H2
Private Const For_Allowundo = &H40

Private Type SHFILEopstruct
hwnd As Long
wfunc As Long
pform As String
pto As String
fflags As Integer
faborted As Boolean
hnamemaps As Long
sprogress As String

End Type

Public Sub copy(ByVal asal As String, ByVal tujuan As String)
Dim x As SHFILEopstruct
With x
.hwnd = 0
.wfunc = FO_Copy
.pform = asal & vbNullChar & vbNllChar
.pto = tujuan & vbNulChar & vbNullChar
.fflags = fof_allowundo
End With
SHFileOperation x
End Sub

Private Sub Command1_Click()
copy Text1.Text, Text2.Text
MsgBox “File Sudah dicopy”
End Sub

Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub

Private Sub Dir2_Change()
Text2.Text = Dir2.Path
End Sub

Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub

Private Sub Drive2_Change()
Dir2.Path = Drive2.Drive
End Sub

 

Private Sub File1_Click()
Text1.Text = File1.Path & “\” & File1.FileName
End Sub