ActiveX exe and Web application

What I want to do is, once Web application is launched, ActiveX exe to launch a form which will behave as a monitor. It should display number of current user of the web application and last session id that entered the application and last session id that left the application.

What I did, I wrote a simple ActiveX exe with a form that displays 3 text areas to display each of the parameter. In the web application, the job is done by global.asa.  But it doesn't work.  Any idea what am i doing wrong?  Follows the code:

Users.exe  Class Module formControl.cls
----------------------------------------
Private uUserForm As userDataForm


Public Sub launchForm()
   Set uUserForm = New userDataForm
   Load uUserForm
End Sub


Public Sub shutForm()
   Unload uUserForm
   Set uUserForm = Nothing
End Sub

Public Sub activeUsers(iActiveUsers)
   Set uUserForm = New userDataForm
   uUserForm.Text1 = iActiveUsers
End Sub


Public Sub connectedSession(SessionID)
   Set uUserForm = New userDataForm
   uUserForm.Text2 = SessionID
End Sub


Public Sub disconnectedSession(SessionID)
   Set uUserForm = New userDataForm
   uUserForm.Text3 = SessionID
End Sub

And web application global.asa:
-------------------------------

<SCRIPT LANGUAGE=VBScript RUNAT=Server>

Sub Application_OnStart
     Application("ACTIVEUSERS") = 0
     set Application("objExe") = Server.CreateObject("Users.formControl")
     call Application("objExe").launchForm()
End Sub


Sub Application_OnEnd
     call Application("objExe").shutForm()
     set Application("objExe") = nothing
End Sub



Sub Session_OnStart
     Application.Lock
          Application("ACTIVEUSERS") = Application("ACTIVEUSERS") + 1
     Application.UnLock
     call Application("objExe").activeUsers(Application("ACTIVEUSERS"))
     call Application("objExe").connectedSession(session.SessionID)
End Sub


Sub Session_OnEnd
     Application.Lock
          Application("ACTIVEUSERS") = Application("ACTIVEUSERS") - 1
     Application.UnLock
     call Application("objExe").activeUsers(Application("ACTIVEUSERS"))
     call Application("objExe").disconnectedSession(session.SessionID)
End Sub

</SCRIPT>

shlomofAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
VincentLawlorConnect With a Mentor Commented:
Allso remove the Set uUserForm from all the subs except

Launch

Vin.
0
 
VincentLawlorCommented:
In launchForm

add the line uUserForm.Show

I have your code working in VB
0
 
VincentLawlorCommented:
Here's the code for your ActiveX Exe

Option Explicit

Private uUserForm As userDataForm


Public Sub launchForm()
  Set uUserForm = New userDataForm
  Load uUserForm
  uUserForm.Show
End Sub


Public Sub shutForm()
  Unload uUserForm
  Set uUserForm = Nothing
End Sub

Public Sub activeUsers(iActiveUsers)
  'Set uUserForm = New userDataForm
  uUserForm.Text1 = iActiveUsers
  uUserForm.Text1.Refresh
End Sub


Public Sub connectedSession(SessionID)
  'Set uUserForm = New userDataForm
  uUserForm.Text2 = SessionID
  uUserForm.Text2.Refresh
End Sub


Public Sub disconnectedSession(SessionID)
  'Set uUserForm = New userDataForm
  uUserForm.Text3 = SessionID
  uUserForm.Text3.Refresh
End Sub

Vin.

0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
shlomofAuthor Commented:
It didn't do any difference - still doesn't display the form.
0
 
VincentLawlorCommented:
Have a look in your task list and see if your exe has been launched.

The code definately works from VB.

I presume you copied and pasted the code above and recompiled the exe.

Vin.
0
 
shlomofAuthor Commented:
As soon as I launch the web application, I can see the exe is launched in the task list and as soon as I stop the IIS, the exe is being stopped.

From VB it is a different story - it will probably work because it is used by the same user.  When you use it from web application, it is different story and currently it doesn't work and this is exactly my problem.
0
 
VincentLawlorCommented:
If you can see it in the task list then the Form show is not being called check the code.

Your exe will be called from the same apartment as your webbrowser so that shouldn't be an issue.

You can check what is happening by opening your project in dev studio and put a break point in the launchForm sub.

Choose Wait For components to be created.

Try and run it from your VBScript

Vin.
0
 
shlomofAuthor Commented:
It doesn't work from web application. Here is the code again:

VB Code:
--------

Private uUserForm As userDataForm


Public Sub launchForm()
   Set uUserForm = New userDataForm
   Load uUserForm
   uUserForm.Show
End Sub


Public Sub shutForm()
   Unload uUserForm
   Set uUserForm = Nothing
End Sub

Public Sub activeUsers(iActiveUsers)
   'Set uUserForm = New userDataForm
   uUserForm.Text1 = iActiveUsers
   uUserForm.Text1.Refresh
End Sub


Public Sub connectedSession(SessionID)
   'Set uUserForm = New userDataForm
   uUserForm.Text2 = SessionID
   uUserForm.Text2.Refresh
End Sub


Public Sub disconnectedSession(SessionID)
   'Set uUserForm = New userDataForm
   uUserForm.Text3 = SessionID
   uUserForm.Text3.Refresh
End Sub


And the web application is:

global.asa
----------

<SCRIPT LANGUAGE=VBScript RUNAT=Server>

Sub Application_OnStart
     Application("ACTIVEUSERS") = 0
     set Application("objExe") = Server.CreateObject("Users.formControl")
     Application("objExe").launchForm()
End Sub


Sub Application_OnEnd
     objExe.shutForm()
     set objExe = nothing
End Sub



Sub Session_OnStart
     Application.Lock
          Application("ACTIVEUSERS") = Application("ACTIVEUSERS") + 1
     Application.UnLock
     Application("objExe").activeUsers(Application("ACTIVEUSERS"))
     Application("objExe").connectedSession(session.SessionID)
End Sub


Sub Session_OnEnd
     Application.Lock
          Application("ACTIVEUSERS") = Application("ACTIVEUSERS") - 1
     Application.UnLock
     Application("objExe").activeUsers(Application("ACTIVEUSERS"))
     Application("objExe").disconnectedSession(session.SessionID)
End Sub

</SCRIPT>


and just a page in the web application:

activeX1.asp
------------

<%@ Language=VBScript %>
<%
Response.Write "This is session = " & session.SessionID
%>


Try it yourself.  It's just doesn't display the form.
0
 
VincentLawlorCommented:
Have you tried debugging into the ActiveX exe ?
0
 
shlomofAuthor Commented:
How can I debbug it when I execute it from web application? As I mentioned, if I create a VB test project, it does display the form.  It just doesn't from web application.
0
 
VincentLawlorCommented:
What I mean is load up the project and follow the instructions I gave previously.

Your VB application will break at the breakpoint you have set.

Vin.
0
 
shlomofAuthor Commented:
VincentLawlor,

FYI, it is impossible to do what I wanted to do.  Your suggestions aren't working.  They work from VB but not from web application.  The reason is that to run such a 'monitor', it needs a certain desktop to run on.  And on which desktop will it run?

Anyway, I will give you the points for the efford.  Thnx :)
0
 
VincentLawlorCommented:
Thanks.

Sorry to hear that :-(

Sounds like you would have to install Dev Studio on the web server and debug from there.

Vin.

0
 
VincentLawlorCommented:
Thanks.

Sorry to hear that :-(

Sounds like you would have to install Dev Studio on the web server and debug from there.

Vin.

0
 
inthedarkCommented:
shlomof, it is possible to do this....
You can create a Windows  NT/2000 service which is updated by the global.asa and your asp. So turn your activex exe into a service.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.