tyy8
asked on
ActiveX exe start up
In an ActiveX project you typically start it at the sub Main (), but if you leave that empty - where in the code would the program start.
Private Sub Class_Initialize()
In whatever is specified in the program properties screen on the general tab. Look for the startup object selection.
-Scott
-Scott
As with any project.. it is always best to start from a Sub Main module and then Navigate from there.. <smile>.
Sub Main, is a great place to define any/all Global variables, functions, and/or subroutines that you have all in one place. It is a great place to put once and done application open and close processing routines, disencumbering you from coding the same in various other Forms.. which can be a pain to locate if you ever have to go back to your code.
All in all, it is a matter of style.. but I prefer to ALWAYS use a Sub Main.. <smile>.
Sub Main, is a great place to define any/all Global variables, functions, and/or subroutines that you have all in one place. It is a great place to put once and done application open and close processing routines, disencumbering you from coding the same in various other Forms.. which can be a pain to locate if you ever have to go back to your code.
All in all, it is a matter of style.. but I prefer to ALWAYS use a Sub Main.. <smile>.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
caraf -
But since it's an exe, it should have a new instantiation every time a user calls it (unlike a dll). So the sub main would get sparked for each user.
But since it's an exe, it should have a new instantiation every time a user calls it (unlike a dll). So the sub main would get sparked for each user.
ASKER
Sadcock -
THe startup property is set to (none) in the dropdown box.
THe startup property is set to (none) in the dropdown box.
ASKER
Erick37 -
WHat if there is more then one class in the project, which class' initialize event would get fired?
WHat if there is more then one class in the project, which class' initialize event would get fired?
tyy8
NO. Try it and see.
NO. Try it and see.
Class_Initialize is fired for every class that you create an instance of.
Dim c as New Class1
'The Intitalize event for Class1 is
' fired prior to the .test call.
c.test
set c = Nothing
Dim c as New Class1
'The Intitalize event for Class1 is
' fired prior to the .test call.
c.test
set c = Nothing
Exactly. If you specify a sub main, this sub is executed the first time ANY object in your ActiveX .exe is instantiated.
As long as the ActiveX .exe remains loaded, this sub won't happen again, no matter *how* many subsequent objects from the ActiveX .exe you load.
As long as the ActiveX .exe remains loaded, this sub won't happen again, no matter *how* many subsequent objects from the ActiveX .exe you load.
ASKER
Oops, yeah - your right. I guess I was thinking of the class being set to singleuse - and that make a new exe everytime.
Okay, I think I'm cleared up on this point. Who wants the points?
Okay, I think I'm cleared up on this point. Who wants the points?
caraf_g:
sub main.. <hat in hand>.. I stand corrected and defer to your wisdom.. <smile>
sub main.. <hat in hand>.. I stand corrected and defer to your wisdom.. <smile>
tyy8, just give the points by accepting whosever comment you deemed most appropriate to your question.
ASKER
Caraf_g:
Your comments were the most enlightening, thanks to everybody, so I'll send the points over to you.
Thanks
Your comments were the most enlightening, thanks to everybody, so I'll send the points over to you.
Thanks