Author Topic: how to load a dll into AutoCAD from http or ftp  (Read 8060 times)

0 Members and 1 Guest are viewing this topic.

michiel

  • Guest
how to load a dll into AutoCAD from http or ftp
« on: March 01, 2012, 11:38:57 AM »
Hi,

How can I load a dll that is not on the local disk? with http or ftp?

Thx

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: how to load a dll into AutoCAD from http or ftp
« Reply #1 on: March 01, 2012, 11:56:44 AM »
Where is it located? if its on the network you load it the same way, with 'Netload'.  I dont think you can load from the internet
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

michiel

  • Guest
Re: how to load a dll into AutoCAD from http or ftp
« Reply #2 on: March 01, 2012, 11:59:55 AM »
its located on the internet...

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: how to load a dll into AutoCAD from http or ftp
« Reply #3 on: March 01, 2012, 12:15:52 PM »
Badbadbadbadbadbadbadbad... there's a reason thats blocked from happening!   :police:
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

michiel

  • Guest
Re: how to load a dll into AutoCAD from http or ftp
« Reply #4 on: March 01, 2012, 12:33:20 PM »
it's my own dll, that I want to share for other people, but not physically give the dll

n.yuan

  • Bull Frog
  • Posts: 348
Re: how to load a dll into AutoCAD from http or ftp
« Reply #5 on: March 01, 2012, 03:02:31 PM »
You need to write code (or find some existing code somewhere) according to the protocol used (http or ftp) to download the DLL file to the CAD computer and save it somewhere in the local drive and then "netload" it. Downloading DLL/EXE is usually considered unsafe. So, the DLL file may have to be zipped up first. In this case, you need to Download->Save->Unzip->NETLOAD.

But do you want user to repeatedly download it from a remote http/ftp server whenevr they run AutoCAD? Or, what you actaully want to do is some kind of auto-update (similar to .NET ClickOnce)? In this case, you'd better kick off a separate updater app (or separate thread) that go the the http/ftp location to check available update/new version, and if found, download to temp. local location, and then prompt user in Acad. Once user choose to update, the updater app will update the local DLLs after Acad shut down, and then restart AutoCAD. It sound easier than actually doing it.

BlackBox

  • King Gator
  • Posts: 3770
Re: how to load a dll into AutoCAD from http or ftp
« Reply #6 on: March 01, 2012, 03:49:31 PM »
Perhaps this old post can be of use.
"How we think determines what we do, and what we do determines what we get."

michiel

  • Guest
Re: how to load a dll into AutoCAD from http or ftp
« Reply #7 on: March 02, 2012, 04:00:31 AM »
I have my file located on the internet(http or ftp doesnt matter) and I want to load de dll file in AutoCAD when the user have permission for working with the dll, but the users don't may have the dll file downloaded on there computer.

A loaded dll in AutoCAD is protected by windows to copy these files?

TheMaster

  • Guest
Re: how to load a dll into AutoCAD from http or ftp
« Reply #8 on: March 02, 2012, 08:34:02 AM »
Badbadbadbadbadbadbadbad... there's a reason thats blocked from happening!   :police:

Actually, if you look at the Assembly.Load overloads you'll note that there
are a few that take byte[] as an argument, rather than a filename.

so.............  :roll:



TheMaster

  • Guest
Re: how to load a dll into AutoCAD from http or ftp
« Reply #9 on: March 02, 2012, 08:35:19 AM »
Hi,

How can I load a dll that is not on the local disk? with http or ftp?

Thx

An assembly can be loaded from an array of byte[] in memory.

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: how to load a dll into AutoCAD from http or ftp
« Reply #10 on: March 02, 2012, 08:44:54 AM »
***WARNING - THIS IS HIGHLY DANGEROUS FOR THE AUTOCAD USER AND WILL ALLOW ACCESS TO A DLL FROM ANYWHERE AND FROM ANYONE ***

Add the line  <loadFromRemoteSources enabled="true" /> to the <runtime> element of Acad.exe.config. Then you can netload it from any location you can browse to.

I don't know why you wouldn't let the user copy the DLL local, that makes no sense to me.  We use this option because I keep the DLLs on a network drive so I dont have to update 30 computers everytime I make a change to a utility.
« Last Edit: March 02, 2012, 08:48:53 AM by MexicanCustard »
Revit 2019, AMEP 2019 64bit Win 10

n.yuan

  • Bull Frog
  • Posts: 348
Re: how to load a dll into AutoCAD from http or ftp
« Reply #11 on: March 02, 2012, 12:45:36 PM »
<loadFromRemoteSources enabled="true" /> only useful if you force Acad to use .NET 4.0, which is only officially supported by Acad2012. With acad2010/11, forcing Acad to use .NET4.0 may have issues, I have heard.


michiel

  • Guest
Re: how to load a dll into AutoCAD from http or ftp
« Reply #12 on: March 03, 2012, 04:36:28 AM »
Thx guys it works.

now I just have the problem that the dll is stored on the local computer in some directory of windows, but I can't find it, because when I load the dll from internet, it works fine the first time, I shut down my internet connection, and then I startup my program again, from the internet source and it still works...

Where is it stored? c:\windows\assembly ? C:\Windows\Microsoft.NET\assembly?

Is it possible to just load the dll in the instances of AutoCAD and is protected?


waterharbin

  • Guest
Re: how to load a dll into AutoCAD from http or ftp
« Reply #13 on: March 04, 2012, 03:20:54 AM »
Hi,michiel. I want to do the same stuff. Can you just share your way?

michiel

  • Guest
Re: how to load a dll into AutoCAD from http or ftp
« Reply #14 on: March 05, 2012, 04:52:19 AM »
1. Add the line  <loadFromRemoteSources enabled="true" /> to the <runtime> element of Acad.exe.config. Then you can netload it from any location you can browse to.

2. Make a new Classlibrary:

[CommandMethod("yourCommand")]
static public void MyNetLoad()
{
 try
 {
        Assembly.LoadFrom(@"http://your network path here");
 }catch(){

 }
}

3. debug, netload the new dll in AutoCAD, enter your command, and normally you can enter the command of the dll which you loaded from the internet