We're trying to get some usage metrics on a VB6 application that we are targeting for migration into newer technologies. It is fairly massive (so big that its brushing up against the limits on numbers of forms etc. that VB6 has) and retrofitting some kind of custom monitoring in itself would not be a small task.
I was hoping that tools like DeskMetrics (I'm not singling them out) would have some kind of legacy COM control that we could drop into every form and with a bit of application level configuration and install of a local (on-site) set of web services we could capture some statistics that would allow us to make some decisions.
There are no directly compatible VB6 libraries available for any of these tracking systems that I could find
Because our customer's sites aren't necessarily fully connected to the internet, we're having trouble finding any platform that can have an install locally at a customer site that is not connected to the wider internet.
So my questions is, are there any libraries/3rd-parties that do fulfil these requirements or are we best off rolling our own very simple tracking solution to a database and collecting that information by some kind of report.
Did you rule out google analytics already? If not this might be a solution
It's been a while for VB6 for me but pretty sure this will work
Create a user control and place a web browser control in side it. Then make the control auto navigate to your own website to a blank page which just has the analytics code on it. On the query string add in the form that is been displayed. This will give you basic form usage information.
If you need to track things further add a method to the control to log events and use ExecScript to call into the analytics api to pass the required information for that form.
Once the control is working should be a simple matter of dropping it onto each form. (You will want to get it to hide it self at runtime of course)
Of course this all relies on your clients having access to internet from their workstation
I did have a project recently where I needed to do something similar. I created a class called clsTrace
Option Explicit Private m_RoutineName As String Public Sub StartTrace(RoutineName As String) m_RoutineName = RoutineName TraceIndent = TraceIndent + 1 Call writeout("Start " & RoutineName) End Sub Private Sub EndTrace(s As String) Call writeout("End " & m_RoutineName) TraceIndent = TraceIndent - 1 End Sub Private Sub Class_Terminate() Call EndTrace(m_RoutineName) End Sub Private Sub writeout(sMessage As String) 'write to database, file, screen, etc End Sub
Added a global var called
Then I wrote a little program to look at the frm, bas, cls files and find function and sub defs (eg Public Sub Private Function Friend Function, etc) along with the names of the defs. After the def, I inserted the line
Dim cTrace as new clsTrace: cTrace.StartTrace(NameOfSourceFile.NameOfFunction).
Because a class is destroyed when exiting a sub\function, the class_terminate will be called automatically on exit. If done correctly, this will produce an indented log file of every entry and exit of your functions\subs.
You should be able to use the output to determine how many times a button was clicked or how many times a form was opened (look for "Start frmName.buttonName_Click" entries).