Author Topic: Best Way to Check License? Timing Problem  (Read 1049 times)

0 Members and 1 Guest are viewing this topic.


  • Guest
Best Way to Check License? Timing Problem
« on: February 13, 2008, 01:57:32 PM »
Thanks largely to Keith's help here, I've written a series of ActiveX DLLs that I want to distribute as an AutoCAD add-on application.  I want to set up a way to have each of the DLLs check the status of a license program.  I thought I'd write a VB6 EXE that would take care of licensing, and then have each DLL check it when started.  I created the EXE as sort of a "TSR", running full time in the background, and then terminating with AutoCAD.  This mechanism seems to work great, but the problem is STARTING the EXE.  I have tried starting it from an MNL file, from a toolbar button just before calling the particular DLL, from ACADDOC -- and in every case it interferes with starting AutoCAD (it starts TWO ACAD.EXEs and some other things).

My latest attempt has been to start the EXE using SHELL, from inside each DLL.  I use a FindInstance check so that if the EXE is already running, the DLL doesn't start a second session.  This also seems to work well except for one problem -- timing.  I can't do a typical Shell-and-Wait because they require the shelled program to END before continuing, and mine doesn't do that.

The EXE has a dialog in it that allows the user to interact with it -- it checks my lock mechanism and makes sure the app is either within its trial period OR is already registered etc.  Again, this works fine.

The problem is that the EXE's lock dialog appears on screen at the same time that the DLL's main (modal) dialog does, even though the Shell process (asynchronous, I know) starts way before the dialog is supposed to appear.  The sequence I describe works great in the IDE, but after compiling the dialogs appear almost simultaneously.  What's wrong with THIS is that if the user cancels the EXE dialog, it's supposed to prevent the DLL's dialog from appearing!  As I say, it works in the IDE but not after compiling.

My best guess so far is that this is a marshalling problem, since the EXE is not inside AutoCAD's process but the DLLs are.  Should I be trying to do the EXE's job with another DLL?

Is there a better way to do what I'm trying to accomplish? :oops:
« Last Edit: February 13, 2008, 04:23:36 PM by LanceG »


  • Guest
Re: Best Way to Check License? Timing Problem
« Reply #1 on: February 14, 2008, 03:37:27 AM »
well this may not be better, but it's what we use and it works. Our program also runs out of process with AutoCAD (as it needs to be compatible with Acad 2000 through 2008)
Rather than have a licensing exe, we use a simple text file ~ encrypted.
When the program starts, it checks for the existance of the license file and verifies it's contents. If all is ok, the program runs in full moce. If there are any problems (e.g. someone tampering with the file contents) then it reverts to demo mode.
It's basic, it's simple but it's been working fine for the last three years


  • Guest
Re: Best Way to Check License? Timing Problem
« Reply #2 on: February 14, 2008, 01:50:19 PM »
I think I'm going to create another ActiveX DLL to handle licensing.  It will be called by each of my "program DLLs" and be set up as a boolean function.  The challenge will be to figure out a way to save the result of the licensing DLL in some globally available way in each AutoCAD session,  so that I don't have to call the licensing DLL each and every time I run a program DLL.  Since each instance of a DLL is destroyed after it finishes, I'm not sure how to pass the license DLL's result from one to another, except maybe with a text file or registry key.:roll: