473,915 Members | 6,883 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

activex lifetime?

I have created a small activex dll to do a background task on my web server. I
fire it off with a set myjob = server.createob ject(myactivex) and it runs.

I do not do a set myjob = nothing and so it seems to keep working even after
the initiating session is closed with session.abandon .

Question... what will be the lifetime of this object and is there a way to tell
if it is dead and needs to be reset... after the session is abandoned I no
longer have a reference to it (myjob)

TIA

Aug 18 '06 #1
6 1708

"fantum" <RE************ *******@hotmail .comwrote in message
news:uC******** ******@TK2MSFTN GP06.phx.gbl...
I have created a small activex dll to do a background task on my web
server. I
fire it off with a set myjob = server.createob ject(myactivex) and it runs.
So the myactivex creates it's own thread to do the work in does it?
If not then server.createob ject blocks at this point, the request never
finishes and any code following it never runs.
I do not do a set myjob = nothing and so it seems to keep working even
after
the initiating session is closed with session.abandon .
This code is probably not ever executed anyway. Avoiding set myobj =
nothing wouldn't help it would be released at the end of the request anyway.
Session.abandon is irrelevant.
Question... what will be the lifetime of this object and is there a way to
tell
if it is dead and needs to be reset... after the session is abandoned I no
longer have a reference to it (myjob)
Until the process in which it is created is terminated.

ASP is not a good place to be performing 'background' tasks. That's what
services are for.

TIA

Aug 18 '06 #2
i would have thought as you stated but...

the process (dll) DOES launch from asp... only setting the activex object =
nothing in the same session stops it... session abandon does not.

i have verified the above and the process is still running (on the server)
after several hours (verified)

now i need to find it and stop it...

any ideas?
In article <Of************ **@TK2MSFTNGP03 .phx.gbl>, An*@yadayadayad a.com
says...
>

"fantum" <RE************ *******@hotmail .comwrote in message
news:uC******* *******@TK2MSFT NGP06.phx.gbl.. .
>I have created a small activex dll to do a background task on my web
server. I
>fire it off with a set myjob = server.createob ject(myactivex) and it runs.

So the myactivex creates it's own thread to do the work in does it?
If not then server.createob ject blocks at this point, the request never
finishes and any code following it never runs.
>I do not do a set myjob = nothing and so it seems to keep working even
after
>the initiating session is closed with session.abandon .

This code is probably not ever executed anyway. Avoiding set myobj =
nothing wouldn't help it would be released at the end of the request anyway.
Session.abando n is irrelevant.
>Question... what will be the lifetime of this object and is there a way to
tell
>if it is dead and needs to be reset... after the session is abandoned I no
longer have a reference to it (myjob)

Until the process in which it is created is terminated.

ASP is not a good place to be performing 'background' tasks. That's what
services are for.

>TIA

Aug 18 '06 #3

"fantum" <RE************ *******@hotmail .comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
i would have thought as you stated but...

the process (dll) DOES launch from asp... only setting the activex object
=
nothing in the same session stops it... session abandon does not.
More code needed since what you are saying doesn't appear to make any sense.

Take a look at this one liner:-

<%
Dim o: Set o = Server.CreateOb ject("MyLib.MyC lass")
%>

When a request is made to this page an instance of MyLib.MyClass is created.
Now that request is finished, despite that a session has been created and
still exists, the variable o is destroyed, if it contains a reference to an
object that reference will be released.

What you seem to be saying is that this component not only is it clever
enough to spin up another thread to do the background task but is also
sensitive to whether VBScript code assigns a nothing to the variable that
received the reference as opposed to it being done automatically when the
script context is torn down.

Session.Abandon is irrelevent all that does is destroy the session object
and any of it's contents. It doesn't affect the currently running script.
i have verified the above and the process is still running (on the server)
after several hours (verified)
Is it a seperate process that is spun up then?
now i need to find it and stop it...

any ideas?
In article <Of************ **@TK2MSFTNGP03 .phx.gbl>, An*@yadayadayad a.com
says...


"fantum" <RE************ *******@hotmail .comwrote in message
news:uC******** ******@TK2MSFTN GP06.phx.gbl...
I have created a small activex dll to do a background task on my web
server. I
fire it off with a set myjob = server.createob ject(myactivex) and it
runs.
>
So the myactivex creates it's own thread to do the work in does it?
If not then server.createob ject blocks at this point, the request never
finishes and any code following it never runs.
I do not do a set myjob = nothing and so it seems to keep working even
after
the initiating session is closed with session.abandon .
This code is probably not ever executed anyway. Avoiding set myobj =
nothing wouldn't help it would be released at the end of the request
anyway.
Session.abandon is irrelevant.
Question... what will be the lifetime of this object and is there a way
to
tell
if it is dead and needs to be reset... after the session is abandoned I
no
longer have a reference to it (myjob)
Until the process in which it is created is terminated.

ASP is not a good place to be performing 'background' tasks. That's what
services are for.

TIA

Aug 18 '06 #4
I know it seems strange but that is what is happening and the reason for this
query.

I included the simple asp code below and the CMSComm is a simple activex based
om the MSComm control.

I put a timer in the CMSComm to write a line to the log every 10 minutes and it
has been reporting for hours.

So far the only way I have found to turn it off is to restart IIS.

It is doing *exactly* what I need but being the curious type I want to know why
it is not working the way I expected which is the way you describe.

yabba

<%
dim x, temp, port, comm, wait, count
dim logPath, logName, bufferPath, bufferName
on error resume next

port = 1
session.timeout = 1
logName = "CMSComm.lo g"
bufferName = "cmscomm.tx t"
logPath = server.mapPath( "../Logs") & "\"
bufferPath = server.mapPath( "../Files") & "\"
set comm = nothing
set comm = createObject("C MSComm.comm")
response.write( now & "<br>")
temp = comm.commVersio n
if err <0 then
response.write "CMSComm not found<br>"
response.end
end if
response.write "CMSComm version " & temp & "<br>"
comm.setLog = logPath & logName
'call comm.clearLog()
comm.setBuffer = bufferPath & bufferName
'call comm.clearBuffe r()
call comm.commClose( 0)
call comm.commOpen(0 , port)
session.abandon
response.end
%>

In article <#Y************ **@TK2MSFTNGP04 .phx.gbl>, An*@yadayadayad a.com
says...
>

"fantum" <RE************ *******@hotmail .comwrote in message
news:%2******* *********@TK2MS FTNGP03.phx.gbl ...
>i would have thought as you stated but...

the process (dll) DOES launch from asp... only setting the activex object
=
>nothing in the same session stops it... session abandon does not.

More code needed since what you are saying doesn't appear to make any sense.

Take a look at this one liner:-

<%
Dim o: Set o = Server.CreateOb ject("MyLib.MyC lass")
%>

When a request is made to this page an instance of MyLib.MyClass is created.
Now that request is finished, despite that a session has been created and
still exists, the variable o is destroyed, if it contains a reference to an
object that reference will be released.

What you seem to be saying is that this component not only is it clever
enough to spin up another thread to do the background task but is also
sensitive to whether VBScript code assigns a nothing to the variable that
received the reference as opposed to it being done automatically when the
script context is torn down.

Session.Abando n is irrelevent all that does is destroy the session object
and any of it's contents. It doesn't affect the currently running script.
>i have verified the above and the process is still running (on the server)
after several hours (verified)

Is it a seperate process that is spun up then?
>now i need to find it and stop it...

any ideas?
In article <Of************ **@TK2MSFTNGP03 .phx.gbl>, An*@yadayadayad a.com
says...
>

"fantum" <RE************ *******@hotmail .comwrote in message
news:uC******* *******@TK2MSFT NGP06.phx.gbl.. .
I have created a small activex dll to do a background task on my web
server. I
fire it off with a set myjob = server.createob ject(myactivex) and it
runs.
>>

So the myactivex creates it's own thread to do the work in does it?
If not then server.createob ject blocks at this point, the request never
finishes and any code following it never runs.

I do not do a set myjob = nothing and so it seems to keep working even
after
the initiating session is closed with session.abandon .
This code is probably not ever executed anyway. Avoiding set myobj =
nothing wouldn't help it would be released at the end of the request
anyway.
>Session.abando n is irrelevant.

Question... what will be the lifetime of this object and is there a way
to
>tell
if it is dead and needs to be reset... after the session is abandoned I
no
>longer have a reference to it (myjob)
Until the process in which it is created is terminated.

ASP is not a good place to be performing 'background' tasks. That's what
services are for.
TIA

Aug 18 '06 #5

"fantum" <RE************ *******@hotmail .comwrote in message
news:u1******** ******@TK2MSFTN GP04.phx.gbl...
I know it seems strange but that is what is happening and the reason for
this
query.

I included the simple asp code below and the CMSComm is a simple activex
based
om the MSComm control.

I put a timer in the CMSComm to write a line to the log every 10 minutes
and it
has been reporting for hours.

So far the only way I have found to turn it off is to restart IIS.

It is doing *exactly* what I need but being the curious type I want to
know why
it is not working the way I expected which is the way you describe.

yabba

<%
dim x, temp, port, comm, wait, count
dim logPath, logName, bufferPath, bufferName
on error resume next

port = 1
session.timeout = 1
logName = "CMSComm.lo g"
bufferName = "cmscomm.tx t"
logPath = server.mapPath( "../Logs") & "\"
bufferPath = server.mapPath( "../Files") & "\"
set comm = nothing
set comm = createObject("C MSComm.comm")
response.write( now & "<br>")
temp = comm.commVersio n
if err <0 then
response.write "CMSComm not found<br>"
response.end
end if
response.write "CMSComm version " & temp & "<br>"
comm.setLog = logPath & logName
'call comm.clearLog()
comm.setBuffer = bufferPath & bufferName
'call comm.clearBuffe r()
call comm.commClose( 0)
call comm.commOpen(0 , port)
session.abandon
response.end
%>
What happens if you replace session.abandon with Set comm = Nothing do logs
stop coming? How about when you remove the final response.end?

At a guess you have a hidden VB6 form on which a MSComm control is sited.
Forms and activeX controls only run in the processes main thread. Hence the
worker thread is able to return control back to your script. The events
coming from the MSComm control will be processed in the main thread. Unless
you build some way to communicate that the form should unload into this
activeX control you only way to kill it is to shutdown the process in which
it runs.

I dread to think what sort of things might go wrong with this. It would be
unreasonable to expect IIS developers to have anticipated VB6 forms running
in the main thread.

>
In article <#Y************ **@TK2MSFTNGP04 .phx.gbl>, An*@yadayadayad a.com
says...


"fantum" <RE************ *******@hotmail .comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
i would have thought as you stated but...

the process (dll) DOES launch from asp... only setting the activex
object
=
nothing in the same session stops it... session abandon does not.
More code needed since what you are saying doesn't appear to make any
sense.

Take a look at this one liner:-

<%
Dim o: Set o = Server.CreateOb ject("MyLib.MyC lass")
%>

When a request is made to this page an instance of MyLib.MyClass is
created.
Now that request is finished, despite that a session has been created and
still exists, the variable o is destroyed, if it contains a reference to
an
object that reference will be released.

What you seem to be saying is that this component not only is it clever
enough to spin up another thread to do the background task but is also
sensitive to whether VBScript code assigns a nothing to the variable that
received the reference as opposed to it being done automatically when the
script context is torn down.

Session.Abandon is irrelevent all that does is destroy the session object
and any of it's contents. It doesn't affect the currently running
script.
i have verified the above and the process is still running (on the
server)
after several hours (verified)
Is it a seperate process that is spun up then?
now i need to find it and stop it...

any ideas?
In article <Of************ **@TK2MSFTNGP03 .phx.gbl>,
An*@yadayadayad a.com
says...
"fantum" <RE************ *******@hotmail .comwrote in message
news:uC******** ******@TK2MSFTN GP06.phx.gbl...
I have created a small activex dll to do a background task on my web
server. I
fire it off with a set myjob = server.createob ject(myactivex) and it
runs.
>

So the myactivex creates it's own thread to do the work in does it?
If not then server.createob ject blocks at this point, the request
never
finishes and any code following it never runs.

I do not do a set myjob = nothing and so it seems to keep working
even
after
the initiating session is closed with session.abandon .


This code is probably not ever executed anyway. Avoiding set myobj =
nothing wouldn't help it would be released at the end of the request
anyway.
Session.abandon is irrelevant.

Question... what will be the lifetime of this object and is there a
way
to
tell
if it is dead and needs to be reset... after the session is
abandoned I
no
longer have a reference to it (myjob)


Until the process in which it is created is terminated.

ASP is not a good place to be performing 'background' tasks. That's
what
services are for.
TIA




Aug 18 '06 #6
snip---
>What happens if you replace session.abandon with Set comm = Nothing do logs
stop coming? How about when you remove the final response.end?
yes, that is the way i usually stop an activex
>At a guess you have a hidden VB6 form on which a MSComm control is sited.
Forms and activeX controls only run in the processes main thread. Hence the
worker thread is able to return control back to your script. The events
coming from the MSComm control will be processed in the main thread. Unless
you build some way to communicate that the form should unload into this
activeX control you only way to kill it is to shutdown the process in which
it runs.
yes, there is a vb6 form that holds the MSComm control but i never show it...
the activex publics are in a class and i call thse to do stuff with the
control.
>I dread to think what sort of things might go wrong with this.
for instance?

It would be
>unreasonable to expect IIS developers to have anticipated VB6 forms running
in the main thread.

>>
In article <#Y************ **@TK2MSFTNGP04 .phx.gbl>, An*@yadayadayad a.com
says...
>

"fantum" <RE************ *******@hotmail .comwrote in message
news:%2******* *********@TK2MS FTNGP03.phx.gbl ...
i would have thought as you stated but...

the process (dll) DOES launch from asp... only setting the activex
object
>=
nothing in the same session stops it... session abandon does not.
More code needed since what you are saying doesn't appear to make any
sense.
>
Take a look at this one liner:-

<%
Dim o: Set o = Server.CreateOb ject("MyLib.MyC lass")
%>

When a request is made to this page an instance of MyLib.MyClass is
created.
>Now that request is finished, despite that a session has been created and
still exists, the variable o is destroyed, if it contains a reference to
an
>object that reference will be released.

What you seem to be saying is that this component not only is it clever
enough to spin up another thread to do the background task but is also
sensitive to whether VBScript code assigns a nothing to the variable that
received the reference as opposed to it being done automatically when the
script context is torn down.

Session.Abando n is irrelevent all that does is destroy the session object
and any of it's contents. It doesn't affect the currently running
script.
>
i have verified the above and the process is still running (on the
server)
>after several hours (verified)
Is it a seperate process that is spun up then?

now i need to find it and stop it...

any ideas?
In article <Of************ **@TK2MSFTNGP03 .phx.gbl>,
An*@yadayadaya da.com
>says...
"fantum" <RE************ *******@hotmail .comwrote in message
news:uC******* *******@TK2MSFT NGP06.phx.gbl.. .
I have created a small activex dll to do a background task on my web
server. I
fire it off with a set myjob = server.createob ject(myactivex) and it
runs.
So the myactivex creates it's own thread to do the work in does it?
If not then server.createob ject blocks at this point, the request
never
>finishes and any code following it never runs.

I do not do a set myjob = nothing and so it seems to keep working
even
>after
the initiating session is closed with session.abandon .
This code is probably not ever executed anyway. Avoiding set myobj =
nothing wouldn't help it would be released at the end of the request
anyway.
Session.abando n is irrelevant.

Question... what will be the lifetime of this object and is there a
way
>to
tell
if it is dead and needs to be reset... after the session is
abandoned I
>no
longer have a reference to it (myjob)
Until the process in which it is created is terminated.

ASP is not a good place to be performing 'background' tasks. That's
what
>services are for.
TIA


Aug 19 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6018
by: wang xiaoyu | last post by:
Hello: i want use activex in wxpython program,but when i use MakeActiveXClass an exception occurs. this is my source code dealing the DICOM ocx.I must note that in this program "hwtxcontrol" is a ocx developed my me use vc6,this ocx works fine in wxpython. but you can see i only change this ocx with a new DICOM ocx and set up eventClass,
2
7586
by: Fie Fie Niles | last post by:
This one XP machine (with IE 6) is having a problem viewing any ActiveX controls (created on VB6) on the Internet Explorer browser. I put the same ActiveX control in a VB program, and when I run the VB program on that same machine, I can view the ActiveX control fine. He is using Citrix. The same ActiveX controls can be viewed on other machines. When trying to view 1 of the ActiveX control, he got an error "Visual Basic Run-time redist...
23
3503
by: Galen Somerville | last post by:
A VB6 ActiveX.exe raises an event which is seen by the VB6 App. Same setup in VB2005. The event to be raised is in form frmSweep. As in VB6, frmSweep is hidden when the events take place. I know by actions on the screen and sounds in the speakers that VB2005 is using the ActiveX.exe correctly. However the events are never raised !!!
14
4392
by: Frederick Gotham | last post by:
There is a common misconception, (one which I myself also held at one point), that a const reference can "extend the lifetime of a temporary". Examples such as the following are given: Snippet (1) ----------- #include <string> using std::string;
6
8089
by: hufaunder | last post by:
I have an ActiveX component that I want to use in a library that I am writing. As a first test I used the ActiveX component in a windows form application. Adding the component created: Ax.dll .dll I can not call the functions in the ActiveX component. In the next step I tried to use the ActiveX component in a class library. I simply added a reference to the corresponding COM component. This this only
3
2349
by: nagashre | last post by:
class A { public: A():a(0), b(0){} handleMyMsg( char* aa, char*bb); private: processMessage();
3
1572
by: mario semo | last post by:
Hello, What does the C++ Norm says about the lifetime of compiler generated temporary variables? #include <stdio.h> class BaseRef { //--------------------------------------------------------------------------
6
2708
by: better_cs_now | last post by:
Hello all, class Foo {/* Details don't matter */}; class Bar { public: Bar(): m_Foo(/* Construct a Foo however it wants to be constructed */); const Foo &GetFoo() const { return m_Foo; } private:
5
1487
by: Juha Nieminen | last post by:
Let's assume we have a class like this: //--------------------------------------------------------- #include <iostream> class MyClass { public: MyClass() { std::cout << "constructor\n"; } ~MyClass() { std::cout << "destructor\n"; }
0
10039
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10923
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11066
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4778
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3368
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.