|
yes ,it can load a dll,but I will overwrite a dll.That means I must unload the dll first,and then overwrite it ,and load it again.
but use assembly ,you can only load a dll,can't unload it.I cann't change the using dll.
????
lost my way
|
|
|
|
|
fftongzhi wrote:
but use assembly ,you can only load a dll,can't unload it.
Unfortunately , the only way to unload an assembly is to unload the appdomain. You will need to load the assembly in a different AppDomain to succeed with your problem. Look at the Supergraph Calculator example on MSDN by Eric Gunnerson (2 parts).
I have attempted this , and failed miserably. So good luck.
|
|
|
|
|
Let me try.............................
lost my way
|
|
|
|
|
Very unfortunately,it don't work either.
It is my codes.
AppDomain appDomain = AppDomain.CreateDomain("mydomain");
Assembly a = appDomain.Load("dlltochange");
Type t = a.GetType("dlltochange.Class1");
MethodInfo mi = t.GetMethod("showstring");
object[] parameter=new object[1];
parameter[0]="hello world";
object obj = Activator.CreateInstance(t);
mi.Invoke(obj,parameter);
AppDomain.Unload(appDomain);
dlltochange is a dll,have Class1 in it,showstring is a function of Class1.
I called the unload,and the dll is in use yet.
And I cann't move the dll to another directory.the parameter of load method can not accept a file name with path.
Will I fail ultimately? Is this a limitation of .net ???
lost my way
|
|
|
|
|
I'm sure there must be a better way but as a workaround, can't you just "DllImport" LoadLibrary and FreeLibrary into your program?
Paul
|
|
|
|
|
And can it load a .net dll? Are you sure?
lost my way
|
|
|
|
|
Nah... course I'm not sure. But are you sure it won't?
Paul
|
|
|
|
|
|
Haha, if you think, you will get think you will get this in few hours, forget it, I broke my head for days on end till I was instutionalized for MS migrane.
Just try, try again
|
|
|
|
|
Before a hard try,find a broad way is important.Do you think so?
And can you make a demo of importing .net dll?
thanks.
lost my way
|
|
|
|
|
Sorry was gonna add this earlier
fftongzhi wrote:
the parameter of load method can not accept a file name with path.
Appends the specified name of the directory to the private path.
[ClassInterface(ClassInterfaceType.None)]<br />
public void AppendPrivatePath(<br />
string path<br />
);
|
|
|
|
|
I have tried it early,but it doesn't work.The dll I load is the dll in current path.append path is useless;
Now the major problem is the dll cann't unload.
lost my way
|
|
|
|
|
Hi
I really want to see this in action too (beside eric's app)!
Have you tried the shadow path, as far as I remember the app will load the assembly in some randon generated directory?
Also, if I remember correctly, Eric makes use of a loader assembly. I cant remmeber the details though
Good luck
|
|
|
|
|
Is that AppDomain.SetCachePath(string)??
It doesn't work too.
yes ,Eric made a loader,but what is the key??
lost my way
|
|
|
|
|
fftongzhi wrote:
Is that AppDomain.SetCachePath(string)??
No
You need to set this via AppDomainSetup in AppDomain.CreateDomain(). I think it has to be done via that function else it will not function.
Its been a while (May) since I attempted this.
fftongzhi wrote:
yes ,Eric made a loader,but what is the key??
I cant remember the exact details, but he did it, so I guess thats necessary
|
|
|
|
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp03122002.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp05162002.asp
Eric ,he is a expert.;)
lost my way
|
|
|
|
|
Any body can help me?????
ooooooooooh!!
lost my way
|
|
|
|
|
I've been told that VS .NET won't work on NT 4.0. Has somebody installed it successfully?
BTW. Do you have any idea, how can I install NT4.0 on a machine that already has Windows XP, without do destroy the WinXP installation? Is it possible at all?
Any tips are appreciated, thank you!
|
|
|
|
|
VS.NET should be fine, but ASP.NET won't run on NT 4.0 (IIS 4.0)
No idea as to your second question.
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
Zinj wrote:
BTW. Do you have any idea, how can I install NT4.0 on a machine that already has Windows XP, without do destroy the WinXP installation? Is it possible at all?
Try a emulator like VMWare. Very slow though. But OK for testing
OR you can be adventurous and install NT4 on a different partition, it might overwrite the bootloader (i cant remember now ), but you can run XP setup up to first reboot and cancel, the boot loader should be replaced and existing XP boot entry should still be there (make a backup of boot.ini). Wow, its been a few years since I worked on that stuff
|
|
|
|
|
I have C++ code that uses the function CryptHashMessage that I am trying to port to C#. Do anyone know of something in C#, that does the same thing?
I believe I searched the System.Security.Cryptography completely.
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
I want to format TimeSpan to output "hh:mm:ss", but when I use the generic TimeSpan.ToString() method, it returns "hh:mm:ss.ffffff". I don't need the fractions of seconds, just the plain seconds.
If I try to do something like,
textBox1.Text = span.ToString("hh:mm:ss");
I get a error,
//error - No overload for method 'ToString' takes '1' arguments.
ToString is listed as overridden but not overloaded in the TimeSpan help
docs with VS.Net.
I've tried converting to,
DateTime dt = new DateTime(span.Ticks);
labelClock.Text= dt.ToString("hh:mm:ss");
But this results with something like, "12:00:00".
Any suggestions?
|
|
|
|
|
Try this
string tempstr = timespan.ToString();<br />
labelClock.Text = tempstr.Substring(0, tempstr.LastIndexOf(".") - 1);
or ... try this (I'm just guessing )
timespan = Timespan.FromSeconds((int)timespan.TotalSeconds);
|
|
|
|
|
leppie wrote:
tempstr.Substring(0, tempstr.LastIndexOf(".") - 1);
Dangerous. Days and fractions of seconds are optional. You could end up getting 8.01:01:01 (8 days, 1 hour, 1 minute, 1 second) and just return "8".
I'd guess the best way is
string str = String.Format("{0:00}:{1:00}:{2:00}", timespan.Hours, timespan.Minutes, timespan.Seconds)
but there may be a better way than that.
Paul
|
|
|
|
|
Thanks leppie and Paul -- That will work, yea I guess this is one for the FAQ on .NET.
|
|
|
|