Announcement

Collapse
No announcement yet.

Default Startup Module Name in VBScript

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Knuth Konrad
    replied
    As Eros said, there's no default startup procedure in VBScript. Therefore I always fake it by doing

    Code:
    ' Possible declarations
    Dim ....
    
    ' First executing code line
    Call Main()
    
    Sub Main()
    
    End Sub
    
    ' Other procedures follow if needed and are called from within Sub Main

    Leave a comment:


  • George Bleck
    replied
    Thank Eros... needed that forceful nature

    Leave a comment:


  • Eros Olmi
    replied
    Usually I do not like "absolute" convinction (there is always someone knowing more than me ) but if you prefer: there is no automatic executed function in VBScript!

    But yes, like you said, there is the constructor of a class that is invoked every time a new object of that class is created but you need to create an object of that class and release it at the end:

    Code:
    Function PBMain
       MsgBox("Hi there from PBMain")
    End Function
     
    Class MyMain
       '---Constructor
       Private Sub Class_Initialize
          PBMain
       End Sub
       '---Destructor
       'Private Sub Class_Terminate
       '   do something at the end
       'End Sub
    End Class
     
    Set MyApplication = New MyMain
    Set MyApplication = Nothing
    At this point it is more easy something like:
    Code:
    Function PBMain
       MsgBox("Hi there from PBMain")
    End Function
     
    Call PBMain
    Last edited by Eros Olmi; 9 Jul 2008, 11:52 PM.

    Leave a comment:


  • George Bleck
    replied
    There is a way to define a default module in a class but i'm not working with classes in this case.

    Leave a comment:


  • George Bleck
    replied
    Aye, I had been reviewing that but there is nothing that points in either direction that I can find.

    I guess I just need to hear "there isn't one" as opposed to not knowing for sure. Programmers mind

    Leave a comment:


  • Eros Olmi
    replied
    Looking at MS documentation at http://msdn.microsoft.com/en-us/libr...7y(VS.85).aspx
    seems not.

    Leave a comment:


  • George Bleck
    started a topic Default Startup Module Name in VBScript

    Default Startup Module Name in VBScript

    Quick question that I just can't seem to find a straight answer on...

    Is there a default first called module in VBScript akin to PBMAIN?

    I know you can have code outside of modules in VBScript but I was trying to determine if there was a default module name which would override/replace stuff that was outside of modules.
    Last edited by George Bleck; 9 Jul 2008, 11:28 AM.
Working...
X