Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2012
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. Private cleanupshsh As String
  2.  
  3. Function IsNumber(ByVal KeyAscii As Integer) As Integer
  4. If InStr(1, "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Chr$(KeyAscii), 0) > 0 Or KeyAscii = 8 Then
  5. IsNumber = True
  6. Else
  7. IsNumber = False
  8. End If
  9. End Function
  10.  
  11. Sub Pause(interval As String)
  12. Dim X
  13. X = Timer
  14.  
  15. Do While Timer - X < Val(interval)
  16. DoEvents
  17. Loop
  18. End Sub
  19.  
  20. Private Sub cmdOK_Click()
  21. Dim AppToRun As String
  22. Dim ParamForApp As String
  23. Dim cmdline As String
  24. Dim sPath As String
  25. Dim obj As Object
  26. Dim oFS As Object
  27.  
  28. If Len(txtStr.Text) <> 16 Then
  29. 'validation
  30. MsgBox "A ECID is 16 Digits Long!", vbExclamation
  31. txtStr.SetFocus
  32. Exit Sub
  33. Else
  34. MousePointer = vbHourglass
  35.  
  36. 'disable Ok button
  37. cmdOK.Enabled = False
  38.  
  39. 'Pause
  40. Pause (4)
  41.  
  42. 'get windows folder
  43. sPath = Environ("windir")
  44.  
  45. 'set Application to Run - this will stay the same
  46. AppToRun = sPath & "\System32\CMD.exe"
  47.  
  48. 'set Command Line Parameters
  49. 'The "/C" Tells Windows to Run The Command then Terminate
  50.  
  51. 'this is your command - keep /C at the begining
  52. ParamForApp = " /C " & """" & App.Path & "\ecid.exe""" & " -v 3.1 -e " & txtStr.Text
  53.  
  54. 'Build Command string
  55. cmdline = AppToRun & ParamForApp
  56.  
  57. 'hide window
  58. 'ExecCmd cmdline, True
  59.  
  60.  
  61. MousePointer = vbDefault
  62.  
  63. 'enable Ok button
  64. cmdOK.Enabled = True
  65.  
  66. 'get desktop folder
  67. Set obj = CreateObject("WScript.Shell")
  68. sPath = obj.SpecialFolders("desktop")
  69. Set obj = Nothing
  70.  
  71. 'desktop path & file name
  72. sPath = sPath & "\" & txtStr.Text & ".shsh"
  73. 'MsgBox Trim(sPath)
  74.  
  75. 'move & rename
  76. Name App.Path & "\00.shsh" As sPath
  77.  
  78. 'delete old shsh file
  79. Shell cleanupshsh, vbHide
  80.  
  81. 'load success message
  82. Unload Me
  83. Load shshsuccess
  84. shshsuccess.Show vbModal
  85.  
  86. End If
  87. End Sub
  88.  
  89. Private Sub Form_Load()
  90. cleanupshsh = "cleanupshsh.bat"
  91. End Sub
  92.  
  93. Private Sub txtStr_KeyPress(KeyAscii As Integer)
  94. If Not IsNumber(KeyAscii) Then KeyAscii = 0
  95. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement