Author Topic: Create ActiveX Object (Help)  (Read 1763 times)

0 Members and 1 Guest are viewing this topic.

AARYAN

  • Newt
  • Posts: 72
Create ActiveX Object (Help)
« on: November 27, 2013, 01:44:59 PM »
Hello All,

I have downloaded a trial software for making dongles.
After installation I have created the dongle but for reading it from port I have to register an supported exe file which I have done.
My question is How will I create an object of that exe from VisualLisp (Vlax-get-or-create-object) to invoke its function to verify the dongle.

Where can I get the Prog-id of it? Or is it not the correct way to create an object?

Any help would be appreciated.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Create ActiveX Object (Help)
« Reply #1 on: November 27, 2013, 11:23:25 PM »
You need its registered name or GUID. This should be the relevant folder in the registry's HKEY_CURRENT_USER\Software\Classes folder (that's what registering the EXE does - create the needed connection codes in registry). Usually the registered name should be something similar to the EXE's name, so open regedit & search (Ctrl+F) for that EXE's name - press F3 to search again for the same name until you find it in one of the Classes' subfolders (note there may be at least 2 - one the GUID the other the name).
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

AARYAN

  • Newt
  • Posts: 72
Re: Create ActiveX Object (Help)
« Reply #2 on: November 28, 2013, 01:22:40 AM »
Thanks for your Reply Irneb.

I have searched the whole registry but I could not find the GUID for the application.
Here is what I did.

1, Run a batch file... ABCD.exe /regserver
2, Trying to make an object as shown in their example code.

Code: [Select]
Private Sub Form_Load()

    Set Kc = New KeyCheck  ' Create object of KeyCheck ActiveX
    Kc.KeyID = ***  ' Define Key ID
    etc.

Code: [Select]
Reply from Support Contact.
The KeyCheck ActiveX is available in

xxx\KeyCheck ActiveX\xxx\ABCD.exe
You have to register it first by using the provided Register.bat.

I do not understand VB code but with the comments I can understand a bit.
Some Questions
1, Is set function make a variable kc?
2, Is Kc.KeyID also a variable?
3, Is it correct to make an ActiveX Object of ABCD.exe.?


Thanks and Best Regards
« Last Edit: November 28, 2013, 01:36:51 AM by AARYAN »

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Create ActiveX Object (Help)
« Reply #3 on: November 28, 2013, 03:22:35 AM »
From that sample VB code it seems that it defines the KeyCheck type as a built-in type for VB (i.e. early-binding before compilation). You should ask them for a sample of late binding - the VB code should have something like a CreateObject call inside it.

The set is similar to Lisp's setq - i.e. define a variable and set its value. [EDIT] In VB set is only needed when the variable holds a newly created object. Otherwise (e.g. variable containing a string / integer) set is not needed. These days in VB.Net set isn't even needed for the object referencing anymore either.

Code - Visual Basic: [Select]
  1. Kc.KeyID = ***
is a form of setting an object's property to a new value. The equivalent in lisp would be:
Code - Auto/Visual Lisp: [Select]
  1. (vlax-put-property Kc "KeyID" ***)

Alternatively, can they tell you if the EXE can be imported as if it's a TLB (type library) file? Some ActiveX EXE's can be used this way. Then you can use vlax-import-type-library to add all the functions to lisp (with your own prefixes). E.g. then you could do something like this:
Code - Auto/Visual Lisp: [Select]
  1. (vlax-import-type-library Path-To-ABCD_EXE "abcd-" "abcd-" "abcd-c-")
  2. (abcd-put-KeyID Kc ***)
« Last Edit: November 28, 2013, 03:29:39 AM by irneb »
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

AARYAN

  • Newt
  • Posts: 72
Re: Create ActiveX Object (Help)
« Reply #4 on: November 30, 2013, 12:37:23 AM »
I have imported Library File but I get the following error.
User warning: assignment to protected symbol: abcdm-functionname <- #<SUBR @10e96398 nil>

With apropos I get all the information of the functions loaded with suffixes of abcdp, abcdm, abcdc

I think the argument required for the function to run is setting as nil.
How do I get rid off this? Any suggestions.

Thanks and Regards