From: BeeJ on
Dee Earley expressed precisely :
> On 12/08/2010 11:44, David Youngblood wrote:
>> "Kevin Provance"<k(a)p.c> wrote in message
>> news:i3ui29$v7h$1(a)news.eternal-september.org...
>>>
>>> "BeeJ"<nospam(a)live.com> wrote in message
>>> news:i3uhh7$g3e$1(a)speranza.aioe.org...
>>> : Dee Earley formulated the question :
>>> :
>>> : But there is no sub main.
>>> : And the ActiveX EXE is starting.
>>> : The entry class has a startup call to a module where a form is opened.
>>> :
>>> : So it looks like even with the parameters set as mentioned in a
>>> : previous post, the ActiveX still opens.
>>> :
>>> : Maybe i can try the App.StartMode and see how it is starting and then
>>> : not call the startup and just drop thru.
>>>
>>> Well, that answers it. If there is no Sub Main, VB automatically loads
>>> the default form at startup.
>>
>> Am I missing something? I can't dublicate that behavior. If I compile an
>> activex.exe with 1 class, 1 form and 1 module with sub main, Double
>> clicking
>> the file does not show a form, does not fire class intialize, does not run
>> sub main and does not show up in Task Manager. Showing a form at start up
>> is
>> not even an option.
>
> That is how it should be (If you'd told it not to use Sub Main).
> I don't know why BeeJ's form was being shown.

I should say, there was no Sub Main and the startup object was set to
none.

It now seems that the ActiveX EXE has two ways of starting now with the
current implementation of a Sub Main and a startup object set to Sub
Main - as a main app instantiation like ActiveX.Entry and as a stand
alone.
I now still have the Class_Initialize call to a module sub that opens a
form but the form only opens when the ActiveX EXE is instantiated by
the main app. As a stand alone it pops up the MsgBox. so all is good.


From: BeeJ on
David Youngblood submitted this idea :
> "Kevin Provance" <k(a)p.c> wrote in message
> news:i3ui29$v7h$1(a)news.eternal-september.org...
>>
>> "BeeJ" <nospam(a)live.com> wrote in message
>> news:i3uhh7$g3e$1(a)speranza.aioe.org...
>> : Dee Earley formulated the question :
>> :
>> : But there is no sub main.
>> : And the ActiveX EXE is starting.
>> : The entry class has a startup call to a module where a form is opened.
>> :
>> : So it looks like even with the parameters set as mentioned in a
>> : previous post, the ActiveX still opens.
>> :
>> : Maybe i can try the App.StartMode and see how it is starting and then
>> : not call the startup and just drop thru.
>>
>> Well, that answers it. If there is no Sub Main, VB automatically loads
>> the default form at startup.
>
> Am I missing something? I can't dublicate that behavior. If I compile an
> activex.exe with 1 class, 1 form and 1 module with sub main, Double clicking
> the file does not show a form, does not fire class intialize, does not run
> sub main and does not show up in Task Manager. Showing a form at start up is
> not even an option.
>
> David

The behavior is when there is NO Sub Main and the startup object is set
to none and the Class_Initialize has a call to a module to open a form.


From: dwy on


"BeeJ" wrote:

> David Youngblood submitted this idea :
> > "Kevin Provance" <k(a)p.c> wrote in message
> > news:i3ui29$v7h$1(a)news.eternal-september.org...
> >>
> >> "BeeJ" <nospam(a)live.com> wrote in message
> >> news:i3uhh7$g3e$1(a)speranza.aioe.org...
> >> : Dee Earley formulated the question :
> >> :
> >> : But there is no sub main.
> >> : And the ActiveX EXE is starting.
> >> : The entry class has a startup call to a module where a form is opened.
> >> :
> >> : So it looks like even with the parameters set as mentioned in a
> >> : previous post, the ActiveX still opens.
> >> :
> >> : Maybe i can try the App.StartMode and see how it is starting and then
> >> : not call the startup and just drop thru.
> >>
> >> Well, that answers it. If there is no Sub Main, VB automatically loads
> >> the default form at startup.
> >
> > Am I missing something? I can't dublicate that behavior. If I compile an
> > activex.exe with 1 class, 1 form and 1 module with sub main, Double clicking
> > the file does not show a form, does not fire class intialize, does not run
> > sub main and does not show up in Task Manager. Showing a form at start up is
> > not even an option.
> >
> > David
>
> The behavior is when there is NO Sub Main and the startup object is set
> to none and the Class_Initialize has a call to a module to open a form.

Yes, I understood what you said. But what I'm saying is, to my knowledge
(and testing) it isn't so. As I said, I can not duplicate the issue.
Class_Initialize does not fire when the ActiveX Exe is ran from explorer.
That's why I asked for code to try to duplicate the problem. I glad to hear
that you to got it working though.

David
From: BeeJ on
dwy wrote :
>
> "BeeJ" wrote:
>
>> David Youngblood submitted this idea :
>>> "Kevin Provance" <k(a)p.c> wrote in message
>>> news:i3ui29$v7h$1(a)news.eternal-september.org...
>>>>
>>>> "BeeJ" <nospam(a)live.com> wrote in message
>>>> news:i3uhh7$g3e$1(a)speranza.aioe.org...
>>>>> Dee Earley formulated the question :
>>>>>
>>>>> But there is no sub main.
>>>>> And the ActiveX EXE is starting.
>>>>> The entry class has a startup call to a module where a form is opened.
>>>>>
>>>>> So it looks like even with the parameters set as mentioned in a
>>>>> previous post, the ActiveX still opens.
>>>>>
>>>>> Maybe i can try the App.StartMode and see how it is starting and then
>>>>> not call the startup and just drop thru.
>>>>
>>>> Well, that answers it. If there is no Sub Main, VB automatically loads
>>>> the default form at startup.
>>>
>>> Am I missing something? I can't dublicate that behavior. If I compile an
>>> activex.exe with 1 class, 1 form and 1 module with sub main, Double
>>> clicking the file does not show a form, does not fire class intialize,
>>> does not run sub main and does not show up in Task Manager. Showing a form
>>> at start up is not even an option.
>>>
>>> David
>>
>> The behavior is when there is NO Sub Main and the startup object is set
>> to none and the Class_Initialize has a call to a module to open a form.
>
> Yes, I understood what you said. But what I'm saying is, to my knowledge
> (and testing) it isn't so. As I said, I can not duplicate the issue.
> Class_Initialize does not fire when the ActiveX Exe is ran from explorer.
> That's why I asked for code to try to duplicate the problem. I glad to hear
> that you to got it working though.
>
> David

Ah. I was thinking the other direction.
I see what you say. But that is exactly what happens.
Now I am curious as to what is going on.
I had no startup object and no sub main. Let me look at the code again
and see. unfortunately i do not know how to step the code from a stand
alone startup to see where it is going. and i do not want to spend the
time adding MsgBox all over to trace. thinking ... (that is more fun
anyway).


From: Kevin Provance on

"BeeJ" <nospam(a)live.com> wrote in message
news:i414di$787$1(a)speranza.aioe.org...
:
: Ah. I was thinking the other direction.
: I see what you say. But that is exactly what happens.
: Now I am curious as to what is going on.
: I had no startup object and no sub main. Let me look at the code again
: and see. unfortunately i do not know how to step the code from a stand
: alone startup to see where it is going. and i do not want to spend the
: time adding MsgBox all over to trace. thinking ... (that is more fun
: anyway).

First, let me disclaimer this by saying everything I learned about ActiveX,
DLL, EXE, COM, etc I learned by reading and rereading on several occasions
Dan Applemans "Developing COM/Active X Components with Visual Basic 6". If
you have the money, I *highly* recommend this book. Along with numerous
examples, Appleman writes the history and detailed explainations of AX and
COM in terms that the VB programmer can easily understand (which is why I
did not say layman, since a basic understanding of VB is required).

As far as BeeJ's issue, I don't know if I understand why exactly his project
was doing what it was doing...since I did not have the actual project and
code in front of me. All I know, and shared and about the siutation is what
I learned - and do with every project I've ever written is the Sub Main
method. Every program has an entry point, which should be - IMO - a
prodecure in a module, regardless the language. I am not a fan of loading a
form to start a project. Again, IMO, it's sloppy. Plus, there are more
freedoms to do other things with Sub Main, as BeeJ has probably learned.

Dee was right about the code starting from Class_Initialize, when accessing
the project via a reference. That is the entry point (or the one VB let's
you see...what goes on in the background is something else, as explained in
Appleman's book, and an entirely different subject) as an AX object. The
alternative way to start the application is via explorer. Since it's now
starting as an EXE, the entry point would be SubMain, or whatever is set as
the Startup Object (not to be confused with StartUp Mode). Since I never
use anything else but Sub Main, BeeJ's problem has never been a problem I
experienced. So instead of spending a lot of time trying to figure out -
remotely even - why B's project was doing what it was doing, it seemed a
better alternative to tell him how to do it what I have perceived as the
correct way, and use Sub Main which fixes the entire problem and frees the
application up to display messages, load objects, or not load
them...whatever.

I should point out that Start Mode (AX versus Standalone) is for design time
only. Once compiled, the mode is determined by how the application is
accessed (starting as EXE or referenced as component). Put another way,
once compiled, the setting is moot.

For more info, if you have the MSDN library installed with your VB setup,
search for the following chapters: "Creating an ActiveX exe component" and
"General principles of component design". Examples available. Plus,
APpleman's book if you can afford it. Aftermarket copies might be available
for less on amazon...if you go that route, make sure you get the CD that
comes with!!!