Private cleanupshsh As String
Function IsNumber(ByVal KeyAscii As Integer) As Integer
If InStr(1, "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Chr$(KeyAscii), 0) > 0 Or KeyAscii = 8 Then
IsNumber = True
Else
IsNumber = False
End If
End Function
Sub Pause(interval As String)
Dim X
X = Timer
Do While Timer - X < Val(interval)
DoEvents
Loop
End Sub
Private Sub cmdOK_Click()
Dim AppToRun As String
Dim ParamForApp As String
Dim cmdline As String
Dim sPath As String
Dim obj As Object
Dim oFS As Object
If Len(txtStr.Text) <> 16 Then
'validation
MsgBox "A ECID is 16 Digits Long!", vbExclamation
txtStr.SetFocus
Exit Sub
Else
MousePointer = vbHourglass
'disable Ok button
cmdOK.Enabled = False
'Pause
Pause (4)
'get windows folder
sPath = Environ("windir")
'set Application to Run - this will stay the same
AppToRun = sPath & "\System32\CMD.exe"
'set Command Line Parameters
'The "/C" Tells Windows to Run The Command then Terminate
'this is your command - keep /C at the begining
ParamForApp = " /C " & """" & App.Path & "\ecid.exe""" & " -v 3.1 -e " & txtStr.Text
'Build Command string
cmdline = AppToRun & ParamForApp
'hide window
'ExecCmd cmdline, True
MousePointer = vbDefault
'enable Ok button
cmdOK.Enabled = True
'get desktop folder
Set obj = CreateObject("WScript.Shell")
sPath = obj.SpecialFolders("desktop")
Set obj = Nothing
'desktop path & file name
sPath = sPath & "\" & txtStr.Text & ".shsh"
'MsgBox Trim(sPath)
'move & rename
Name App.Path & "\00.shsh" As sPath
'delete old shsh file
Shell cleanupshsh, vbHide
'load success message
Unload Me
Load shshsuccess
shshsuccess.Show vbModal
End If
End Sub
Private Sub Form_Load()
cleanupshsh = "cleanupshsh.bat"
End Sub
Private Sub txtStr_KeyPress(KeyAscii As Integer)
If Not IsNumber(KeyAscii) Then KeyAscii = 0
End Sub