Solved

ActiveX exe and Web application

Posted on 2001-07-12
15
258 Views
Last Modified: 2008-03-17
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>

0
Comment
Question by:shlomof
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 5
15 Comments
 
LVL 4

Expert Comment

by:VincentLawlor
ID: 6276542
In launchForm

add the line uUserForm.Show

I have your code working in VB
0
 
LVL 4

Accepted Solution

by:
VincentLawlor earned 50 total points
ID: 6276551
Allso remove the Set uUserForm from all the subs except

Launch

Vin.
0
 
LVL 4

Expert Comment

by:VincentLawlor
ID: 6276558
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:shlomof
ID: 6277030
It didn't do any difference - still doesn't display the form.
0
 
LVL 4

Expert Comment

by:VincentLawlor
ID: 6277053
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
 

Author Comment

by:shlomof
ID: 6277253
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
 
LVL 4

Expert Comment

by:VincentLawlor
ID: 6277416
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
 

Author Comment

by:shlomof
ID: 6277740
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
 
LVL 4

Expert Comment

by:VincentLawlor
ID: 6277788
Have you tried debugging into the ActiveX exe ?
0
 

Author Comment

by:shlomof
ID: 6277861
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
 
LVL 4

Expert Comment

by:VincentLawlor
ID: 6277886
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
 

Author Comment

by:shlomof
ID: 6307657
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
 
LVL 4

Expert Comment

by:VincentLawlor
ID: 6307679
Thanks.

Sorry to hear that :-(

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

Vin.

0
 
LVL 4

Expert Comment

by:VincentLawlor
ID: 6307681
Thanks.

Sorry to hear that :-(

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

Vin.

0
 
LVL 17

Expert Comment

by:inthedark
ID: 7116026
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

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month11 days, 8 hours left to enroll

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question