Author Topic: loading a .dll activex from vlisp  (Read 3622 times)

0 Members and 1 Guest are viewing this topic.

masoud_123

  • Guest
loading a .dll activex from vlisp
« on: November 21, 2014, 04:51:45 AM »
Hi

I have a .dll activex written in VB6, it needs a sting as argument (assuming a path)

The project name is:  prjName
The Class name is: prjClass
The function name is: FuncName
The function parameter name is: FuncParameter

how can load it from vlisp?


I've registered .dll and used this code but doesn't work!  :-(


Code: [Select]
(defun load-dll (FuncParameter )
(vl-load-com)
 (setq acadApp (vlax-get-acad-object))
 (setq vbApp (vla-GetInterfaceObject acadApp "prjName.prjClass"))
 (if
   (not vbApp)
   (princ "\nError loading Activex DLL")
 )

 (vlax-invoke vbApp "FuncName" FuncParameter )
)

error: Automation Error. Problem in loading application



ChrisCarlson

  • Guest
Re: loading a .dll activex from vlisp
« Reply #1 on: November 21, 2014, 08:16:09 AM »
Based on the way the code looks your .dll is within a directory scanned by ACAD?

masoud_123

  • Guest
Re: loading a .dll activex from vlisp
« Reply #2 on: November 21, 2014, 08:23:14 AM »
Based on the way the code looks your .dll is within a directory scanned by ACAD?

No,because  it's registered. Is it important to be in a scanned directory of ACAD?

ChrisCarlson

  • Guest
Re: loading a .dll activex from vlisp
« Reply #3 on: November 21, 2014, 09:41:16 AM »

masoud_123

  • Guest
Re: loading a .dll activex from vlisp
« Reply #4 on: November 21, 2014, 10:23:04 AM »

BlackBox

  • King Gator
  • Posts: 3770
Re: loading a .dll activex from vlisp
« Reply #5 on: November 21, 2014, 10:41:38 AM »
http://www.cadtutor.net/forum/showthread.php?83028-Add-a-.DLL-Command-into-your-Startup-Lisp-Routine


Based on Lee using findfile, I'd assume so.

Unfortunately, it doesn't work... :-( :-(

Any suggestion?

Does the assembly (i.e., .DLL) reside within Support File Search Path (SFSP)?

If not, did you supply the full file path to same within the NETLOAD call?

Does the assembly reside in a local folder, or on a network folder?

If a network folder, have you enabled LoadFromRemoteSources XmlAttribute in Acad.exe.Config?
"How we think determines what we do, and what we do determines what we get."

masoud_123

  • Guest
Re: loading a .dll activex from vlisp
« Reply #6 on: November 21, 2014, 10:54:37 AM »
http://www.cadtutor.net/forum/showthread.php?83028-Add-a-.DLL-Command-into-your-Startup-Lisp-Routine


Based on Lee using findfile, I'd assume so.

Unfortunately, it doesn't work... :-( :-(

Any suggestion?

Does the assembly (i.e., .DLL) reside within Support File Search Path (SFSP)?

If not, did you supply the full file path to same within the NETLOAD call?

Does the assembly reside in a local folder, or on a network folder?

If a network folder, have you enabled LoadFromRemoteSources XmlAttribute in Acad.exe.Config?

.dll file resides support search path
I am not using netload because the function needs and argument (a string)
.dll file is located in local folder

BlackBox

  • King Gator
  • Posts: 3770
Re: loading a .dll activex from vlisp
« Reply #7 on: November 21, 2014, 11:12:20 AM »
http://www.cadtutor.net/forum/showthread.php?83028-Add-a-.DLL-Command-into-your-Startup-Lisp-Routine


Based on Lee using findfile, I'd assume so.

Unfortunately, it doesn't work... :-( :-(

Any suggestion?

Does the assembly (i.e., .DLL) reside within Support File Search Path (SFSP)?

If not, did you supply the full file path to same within the NETLOAD call?

Does the assembly reside in a local folder, or on a network folder?

If a network folder, have you enabled LoadFromRemoteSources XmlAttribute in Acad.exe.Config?

.dll file resides support search path
I am not using netload because the function needs and argument (a string)
.dll file is located in local folder

Disclosure: I only code in LISP & .NET; skipped VBA altogether.

AFAIK, a .DLL does not need a parameter to LOAD... However, it may require an argument to evaluate a Method/Function, no?

Did you compile for correct environment (x86, x64)?
"How we think determines what we do, and what we do determines what we get."

masoud_123

  • Guest
Re: loading a .dll activex from vlisp
« Reply #8 on: November 21, 2014, 11:19:25 AM »
http://www.cadtutor.net/forum/showthread.php?83028-Add-a-.DLL-Command-into-your-Startup-Lisp-Routine


Based on Lee using findfile, I'd assume so.

Unfortunately, it doesn't work... :-( :-(

Any suggestion?

Does the assembly (i.e., .DLL) reside within Support File Search Path (SFSP)?

If not, did you supply the full file path to same within the NETLOAD call?

Does the assembly reside in a local folder, or on a network folder?

If a network folder, have you enabled LoadFromRemoteSources XmlAttribute in Acad.exe.Config?

.dll file resides support search path
I am not using netload because the function needs and argument (a string)
.dll file is located in local folder

Disclosure: I only code in LISP & .NET; skipped VBA altogether.

AFAIK, a .DLL does not need a parameter to LOAD... However, it may require an argument to evaluate a Method/Function, no?

Did you compile for correct environment (x86, x64)?

Yes, it needs a path as an argument to evaluate something,
and it's compiled for x86 environment.

BlackBox

  • King Gator
  • Posts: 3770
Re: loading a .dll activex from vlisp
« Reply #9 on: November 21, 2014, 11:30:33 AM »
Yes, it needs a path as an argument to evaluate something,
and it's compiled for x86 environment.

You need to load the assembly before you can evaluate a function that the assembly defines.

What version of AutoCAD are you compiling for, and is it x86, or x64?

Did you update all of your references prior to compiling the assembly?
"How we think determines what we do, and what we do determines what we get."

masoud_123

  • Guest
Re: loading a .dll activex from vlisp
« Reply #10 on: November 22, 2014, 02:41:56 AM »
Yes, it needs a path as an argument to evaluate something,
and it's compiled for x86 environment.

You need to load the assembly before you can evaluate a function that the assembly defines.

What version of AutoCAD are you compiling for, and is it x86, or x64?

Did you update all of your references prior to compiling the assembly?

Im using autocad 2013 64 bit. and updated all refrences before compliling.

owenwengerd

  • Bull Frog
  • Posts: 451
Re: loading a .dll activex from vlisp
« Reply #11 on: November 22, 2014, 09:35:49 AM »
... it's compiled for x86 environment.

If you're using 64-bit AutoCAD, then your DLL needs to be 64-bit as well.

BlackBox

  • King Gator
  • Posts: 3770
Re: loading a .dll activex from vlisp
« Reply #12 on: November 22, 2014, 02:25:45 PM »
1+

This is but one of the many advantages of .NET over VBA, in that one can simply compile a non-environment-dependent assembly using 'Any CPU', and the resultant assembly can be loaded into both x86 and x64 versions.
"How we think determines what we do, and what we do determines what we get."