Can VB Com object used by ASP get events fired by an internal object?

G

Grant Schenck

I have a VC++ COM object which fires an event. I've written VB EXE apps
against it and they receive the event notification.

I've now built a simple VB COM object which uses the VC++ COM object
internally.

My question is, assuming the ASP page which loads the object does not
immediately exit, will the VB COM object be able to receive the events from
the internal object?

Thanks, Grant Schenck
 
M

[MSFT]

Hello Grant,

What do you mean " the object does not immediately exit" in asp? Normally,
a COM object will be released after current response was sent. Also, did
you create the VB COM object or VC object in asp?

Luke
 
G

Grant Schenck

The light is slowly going on (I appologize as I'm very new to ASP.)

Yes, I guess I have to look at creating and initializing the object in
global.asa. This way it will stay alive independently from requests.

Thanks, Grant Schenck
 
G

Grant Schenck

OK, follow-up question...

I'm using gobal.asa bit it doens't seem to work as I expected...

In it I handle both the OnStart and OnEnd.

In the OnStart I create an object and save a reference as follows:

Sub Application_OnStart
On Error Resume Next
Dim ShoreTelMakeCallTransfer
Application("ShoreTelMakeCallTransfer") = NULL
set ShoreTelMakeCallTransfer =
Server.CreateObject("STMakeCallTransfer.STObject")
set Application("ShoreTelMakeCallTransfer") = ShoreTelMakeCallTransfer
ShoreTelMakeCallTransfer.Initialize("152")
End Sub

What I see is that the following sequence of calls into my object when I
load an ASP page from the web app:

- OnStartPage
- My intialize call
- OnEndPage
- Control is unloaded

This all happens right as the page load, i.e., the object does NOT stay
instantiated!

I copied this code from a system which does appear to work correctly so I'm
not sure what I'm doing wrong.

Any ideas?

Thanks, Grant Schenck
 
M

[MSFT]

Hello Grant,

When I review another post, I found you have found that porblem is related
to STA COM object you use in ASP, and you have planed to create a MTA in
VC. For your question about the message ASP->MTA->STA, can you explain in
more detail?

Luke
 
G

Grant Schenck

Hey Luke,

Thanks for responding.

Yes, I have an existing STA. I want to use the STA from an ASP but ASP
doesn't allow direct use of an STA.

So, I wrote a C++ based MTA which internally uses the STA. I can now call
methord on the MTA which in turn may use methods of the internal STA. All
is good.

Now the one problem I have is that the STA internally uses a Windows Timer
:):SetTimer.)

If I use the MTA from a VB application then the internal STA gets timer
function call backs.

HOWEVER, if I create the MTA from my asp project's global.asa
session_OnStart and put a reference to the MTA in the application object
then my internal STA's timer function call back doesn't appear to get
called.

So, my core question is, what do I need to do in my MTA in order to service
the STA's timer. I'm thinking I somehow need to start a thread in the MTA
which will pump messages on behalf of the STA...?

On the other hand, maybe this should work and I'm just doing something
stupid.

Thanks!

Grant Schenck
 
G

Grant Schenck

Luke,

A quick follow-up...

This is interesting. I am running the debug version of my STA and it hit an
ATLASSERT. No visible error, browser just sat with no output.

Now, what was interesting is that my trace output from my timer proc showed
that I was getting callbacks in my timer proc..

I'm guessing that what is happening is that the ATLASSERT dialog is shown in
some IIS account where I can't see it and while that dialog is displayed,
Windows is pumping messages?

Grant
 
M

[MSFT]

Hi Grant,

As I understand, you want to pop up a dialog in the ASP application? When
an ASP application is running, we cannot see any UI from it, even the
dialog was created in COM component. Normally, when we need output some
debug or log information in ASP, we can write the info to a text file or
system log internally.

Luke
 
G

Grant Schenck

Hey Luke,

No, I was just trying to field an event fired by an STA from an MTA. The
STA kicks off a windows timer (SetTimer) to check for when it wants to fire
the events. It appears that the STA's timer messages don't work if the
STA's client is an MTA which is inturn called from ASA/ASP.

Grant
 
M

[MSFT]

Hello Grant,

How did you check if the STA's timer messages work, by ATLASSERT dialog?
This dialog won't be displayed if the STA component is run in ASP. An ASP
application didn't have any windows UI yet.

Luke
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top