TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: masoud_123 on November 21, 2014, 04:51:45 AM

Title: loading a .dll activex from vlisp
Post by: masoud_123 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


Title: Re: loading a .dll activex from vlisp
Post by: ChrisCarlson on November 21, 2014, 08:16:09 AM
Based on the way the code looks your .dll is within a directory scanned by ACAD?
Title: Re: loading a .dll activex from vlisp
Post by: masoud_123 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?
Title: Re: loading a .dll activex from vlisp
Post by: ChrisCarlson on November 21, 2014, 09:41:16 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.
Title: Re: loading a .dll activex from vlisp
Post by: masoud_123 on November 21, 2014, 10:23:04 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?
Title: Re: loading a .dll activex from vlisp
Post by: BlackBox 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 (http://through-the-interface.typepad.com/through_the_interface/2011/07/loading-blocked-and-network-hosted-assemblies-with-net-4.html) XmlAttribute in Acad.exe.Config?
Title: Re: loading a .dll activex from vlisp
Post by: masoud_123 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 (http://through-the-interface.typepad.com/through_the_interface/2011/07/loading-blocked-and-network-hosted-assemblies-with-net-4.html) 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
Title: Re: loading a .dll activex from vlisp
Post by: BlackBox 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 (http://through-the-interface.typepad.com/through_the_interface/2011/07/loading-blocked-and-network-hosted-assemblies-with-net-4.html) 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)?
Title: Re: loading a .dll activex from vlisp
Post by: masoud_123 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 (http://through-the-interface.typepad.com/through_the_interface/2011/07/loading-blocked-and-network-hosted-assemblies-with-net-4.html) 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.
Title: Re: loading a .dll activex from vlisp
Post by: BlackBox 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?
Title: Re: loading a .dll activex from vlisp
Post by: masoud_123 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.
Title: Re: loading a .dll activex from vlisp
Post by: owenwengerd 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.
Title: Re: loading a .dll activex from vlisp
Post by: BlackBox 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.