473,728 Members | 2,064 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 1700

"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
5994
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
7573
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
3476
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
4380
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
8077
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
2340
by: nagashre | last post by:
class A { public: A():a(0), b(0){} handleMyMsg( char* aa, char*bb); private: processMessage();
3
1565
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
2696
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
1481
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
8904
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
8759
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9424
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9198
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
9135
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...
0
8133
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6718
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
4524
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4793
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.