home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / formre1r / commandw.bas next >
Encoding:
BASIC Source File  |  1999-08-19  |  1.9 KB  |  47 lines

  1. Attribute VB_Name = "CommandWrapper"
  2. Option Explicit
  3.  
  4. Sub Main()
  5.     Dim strCommand As String, strObjectPath As String, menum As Variant
  6.     
  7.     On Error GoTo ErrorHandler
  8.     
  9.     strCommand = Trim$(Command())
  10.     strObjectPath = Trim$(Mid(strCommand, InStr(strCommand, Chr(32))))
  11.    
  12.     If InStr(strCommand, "/register") <> 0 Then
  13.         'register object
  14.         menum = RegisterComponent(strObjectPath, DllRegisterServer)
  15.         If menum = [File Could Not Be Loaded Into Memory Space] Then
  16.             MsgBox "File Could Not Be Loaded Into Memory Space", vbExclamation
  17.         ElseIf menum = [Not A Valid ActiveX Component] Then
  18.             MsgBox "Not A Valid ActiveX Component", vbExclamation
  19.         ElseIf menum = [ActiveX Component Registration Failed] Then
  20.             MsgBox "ActiveX Component Registration Failed", vbExclamation
  21.         ElseIf menum = [ActiveX Component Registered Successfully] Then
  22.             MsgBox "ActiveX Component Registered Successfully", vbExclamation
  23.         End If
  24.     ElseIf InStr(strCommand, "/unregister") <> 0 Then
  25.         'unregister object
  26.         menum = RegisterComponent(strObjectPath, DllUnRegisterServer)
  27.         If menum = [File Could Not Be Loaded Into Memory Space] Then
  28.             MsgBox "File Could Not Be Loaded Into Memory Space", vbExclamation
  29.         ElseIf menum = [Not A Valid ActiveX Component] Then
  30.             MsgBox "Not A Valid ActiveX Component", vbExclamation
  31.         ElseIf menum = [ActiveX Component Registration Failed] Then
  32.             MsgBox "ActiveX Component Registration Failed", vbExclamation
  33.         ElseIf menum = [ActiveX Component UnRegistered Successfully] Then
  34.             MsgBox "ActiveX Component UnRegistered Successfully", vbExclamation
  35.         End If
  36.     Else
  37.         MsgBox "Invalid Command Action", vbExclamation
  38.     End If
  39.             
  40.     End
  41.             
  42. ErrorHandler:
  43.     MsgBox Err.Number & " - " & Err.Description
  44.     End
  45.     
  46. End Sub
  47.