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

Discussion in 'ASP General' started by Grant Schenck, Apr 13, 2005.

  1. 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
    Grant Schenck, Apr 13, 2005
    #1
    1. Advertising

  2. Grant Schenck

    [MSFT] Guest

    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
    [MSFT], Apr 14, 2005
    #2
    1. Advertising

  3. 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

    "[MSFT]" <> wrote in message
    news:...
    > 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
    >
    Grant Schenck, Apr 14, 2005
    #3
  4. 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


    "Grant Schenck" <> wrote in message
    news:eTn$...
    > 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
    >
    > "[MSFT]" <> wrote in message
    > news:...
    > > 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
    > >

    >
    >
    Grant Schenck, Apr 14, 2005
    #4
  5. Grant Schenck

    [MSFT] Guest

    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
    [MSFT], Apr 15, 2005
    #5
  6. 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


    "[MSFT]" <> wrote in message
    news:#...
    > 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
    >
    Grant Schenck, Apr 15, 2005
    #6
  7. 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

    "Grant Schenck" <> wrote in message
    news:...
    > 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
    >
    >
    > "[MSFT]" <> wrote in message
    > news:#...
    > > 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
    > >

    >
    >
    Grant Schenck, Apr 15, 2005
    #7
  8. Grant Schenck

    [MSFT] Guest

    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
    [MSFT], Apr 18, 2005
    #8
  9. 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

    "[MSFT]" <> wrote in message
    news:...
    > 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
    >
    Grant Schenck, Apr 25, 2005
    #9
  10. Grant Schenck

    [MSFT] Guest

    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
    [MSFT], Apr 26, 2005
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. CoolPint
    Replies:
    8
    Views:
    454
    Alf P. Steinbach
    Aug 30, 2004
  2. Replies:
    7
    Views:
    602
    Bruno Alexandre
    May 24, 2006
  3. Casey Hawthorne
    Replies:
    1
    Views:
    689
    Arne Vajhøj
    Mar 18, 2009
  4. Chris

    Events Events Events Please Help

    Chris, Aug 30, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    327
    Chris
    Aug 30, 2005
  5. Richard Huang
    Replies:
    1
    Views:
    116
Loading...

Share This Page