• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 608
  • Last Modified:

ActiveX.exe's and CCRP Timers

Hello Experts, I have created an application to monitor up to 40 machines in an industrial environment. I use an activex.exe to make the network connection and monitor the machine. When the main application loads it looks at a list of IP Addresses and creates an instance of the activex.exe for each IP Address. Each instance is assigned to one machine. Within the activex.exe I am using the CCRP timer to get status information of the machine once every second. The first time the timer starts the network connection is established. Each time the timer fires it checks  the network connection. If there is a connection then it askes for the status of the machine.

I have found that I am only able to connect to 16 machines out of 40. In reading it appears that a 32 bit operating system can only run 16 timers per process. If that is what I am running into, then my activeX.exe's are not running in their own process. Is that right? So if my activex.exe's were each running in their own process then I should not have any trouble?

Can someone please verify this for me?
  • 3
  • 2
1 Solution
Hello, here my question is
for each one IP there is one exe instance and for each instance there is one time running?
or there are 40 IP and then each had got the Exe, and again each hs got one timer??
can you please  explain the scenario in this manner
What Threading model did you select for the App (see Project Properties - General)?

First you need to check that your local system can handle that many packets per second, this depends on your switch speed and ave. size of packets:


Why don't you change the app into an event driven app.  Once a connection is established the remote client (which is in fact an IP server app) queues data into blocks and then simply sends the data back to the central system.

All  the central system has to do then is monitor when the last packet was received from each remote.

In this way you will cut down the bandwidth required by about 50% and the jobs the the server needs to do by 50%.

After a few seconds of inactivity a remote can send an "I am still on line" packet.

BasicfarmerAuthor Commented:
I am usinig Thread Per Object threading model.

The main program looks as a list of IP Address in a database. For each IP Address it creates the activex.exe which handles that machine. Each activeX.exe has a timer in it which is being used to poll the machine for status. There are 40 machines and so once the main program is up and running it has created 40 activex.exe's. One for each machine. All the activeX.exe's report status back to the main program which is just a GUI for the user. Currently everything works except I am only able to connect to 16 machines. I can disconnect one of the machines and another one will then connect. But I can only be connected to 16 machines at one time. I am using the CCRP multimedia timer in the activex'exe's and I am using the Dart Power TCP winsock tool for the connections.
Independent Software Vendors: 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!

With an ActiveX EXE you only need one of them.  You can create a public class within the EXE.

Re remote process can then create objects within the class (or the class can create objects within itself).

You need just one form with a winsock on it.

When the public class initialises it create a new instance of the form and maps to the winsock on the form so that class lock like this:

------------------Public Class Monitor.cls withn project called MyProject

Option Explicit
Dim MyForm As frmSock ' a form named frmSock with just a winsock on the form named WinSck
Private WithEvents sckMyWinSock  As Winsock      

Public IsConnected As Boolean
Public LastActivity As Date

Private Sub Class_Initialise()

Set MyForm = New frmSock
Set sckMail = MyForm.WinSck

End Sub

Public Sub Activate(psHost as String, plPort As Long)

'Connect to host
' open an session...
With sckMyWinSock
    If .state <> sckClosed Then
    End If
    .RemoteHost = psHost
    .RemotePort = plPort
    If .state <> sckClosed Then Exit Function
    pbConnected = False
End With

End Sub

You can then active a new connection as follows:

Dim Monitor(40)

Set Monitor(0) = CreateObject("MyProject.Monitor")

Monitor(0).Activate "", 12345

Set Monitor(1) = CreateObject("MyProject.Monitor")

Monitor(1).Activate "MyRemoteName", 12345

Or create objects in a loop:

For lc = 0 To Ubound sHostList()
    Set Monitor(lc) = CreateObject("MyProject.Monitor")

    Monitor(lc).Activate sMyHostList(lc), 12345

The ActiveX EXE can also launch its own objects by creating instances within its own Sub Main()
But the sub main should start a control form that then launches the classes.

In this way you only have one exe running.

The PC will have limitations but it is more likely to be able to able to handle one exe running 40 tasks.

The control form could then look through each connected client using one timer.

Private Sub MyTimer_Timer()

   lC = lC +1
   If lC> Ubound(msHostList) Then
   End If

   If Now-Monitor(lc).LastActivity> OneSecond Then
       Montor(lc).LastActivity = Now
       Exit Sub
   End If
End Sub

BasicfarmerAuthor Commented:
OK, let me try and get my head around this a little bit and I will get back to you with some questions.
One exe with 40 jobs will use way less resources than 40 exes.

The code for each job will only be in memory once even though it will have 40 data spaces.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now