|
Hello,
I want to share datas managed in a DLL that is called by 2 different applications.
Someone said me sometimes a DLL with singleton can have 2 instances.
An other solutions exists ?
thanks
Freg
|
|
|
|
|
When a DLL is used by a process, a "fresh copy" of it is loaded into that processes address space. The singleton instance of a class in one process is a separate entity from the singleton instance in another process.
What you could do is use .NET remoting to host a singleton instance of your class. When either of your apps needs to access that truly unique instance, it would request it from the remoting service. If you need more info about remoting and singleton activation, CP has some great articles on that subject.
Josh
|
|
|
|
|
Are these applications running on the same machine or on a network?
Best,
Jun
|
|
|
|
|
|
Then it looks like a typical IPC case. In theory, all IPC mechanisms may work for your purpose, but "shared memory" should be an effective solution for significant amount of data sharing. On Windows platform, it's implemented as "memory-mapped files" or MMF. An MMF is a kernel object that maps a disk file to certain memory block of your process address space so that multiple processes/DLLs can access the same data as if they were accesing its own process data.
Google "sheared memory" or "memory-mapped file" to get yourself on the track. If you need more guidance, drop a line here.
Best,
Jun
|
|
|
|
|
The smallest deployment unit that exist in .NET is an assembly, but when you create an assembly (*.dll, *.exe), this makes them like small islands to comunicate them you need to use things like .NET Remoting to be able to let them talk, but the use of such power solution will make sense only if you are talking about processes(running in the back) or executable applications because either a private or public dll can be used in many applications at the same time with no problems.
Hope this help
|
|
|
|
|
Hi EveryOne
In VC.NET I added a button control Dynamically
My Code is:
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e)
{
array<Button^>^ myButton = gcnew array<Button^>(10);
myButton[0]=gcnew Button();
myButton[0]->Location = System::Drawing::Point(300, 189);
myButton[0]->Name = L"button123";
myButton[0]->Size = System::Drawing::Size(148, 41);
myButton[0]->TabIndex = 1;
myButton[0]->Text = L"Added";
myButton[0]->UseVisualStyleBackColor = true;
this->Controls->Add(myButton[0]);
this->button123->Click += gcnew System::EventHandler(this, Form1::button123_Click);
}
But
When I Added the folowing(below) code:
private: System::Void button123_Click(System::Object^ sender, System::EventArgs^ e)
{
MessageBox::Show("Verified");
}
and compiled
Then Following Error
form1 doesn't have button123
some body should help me to get rid of this problem
OK....
-- modified at 7:23 Tuesday 20th June, 2006
|
|
|
|
|
Nagaraju_Focus wrote: myButton[0]->Name = L"button123";
The Name property of a control has nothing to do with the name of a variable that the compiler can recognize. Use myButton[0]->Click instead of button123->Click.
Josh
|
|
|
|
|
Thank You
Its working fine
|
|
|
|
|
Hi Every One
i am new to .net programming
in which i am facing problem to accessing database such as
SQLServer
I request kindly send me a procedure for accessing database
OK
Bye...........
G.Nagaraju
G.Nagaraju
|
|
|
|
|
|
If I write a pure C# application, only using the standart publi API, no interop, the same binary should work well on32 bit, 64 bits and perhaps on the compact framework as well if I link against it.
Now how could I achieve the same thing if I do interop and I have a managed C++ API?
let say I have a managed C++ module compiled for 3 different target but with always the same interface:
mycppmodule32.dll
mycppmodule64.dll
mycppmoduleCE.dll
let say in the C# code I also do some interop
internal class User32 // & CE ?!
{
[DllImport("USER32")]
public IntPtr GetHdc(IntPtr hWnd); // 4 byte IntPtr
}
internal class User64 // not sure it exists, but I assume....
{
[DllImport("USER64")]
public IntPtr GetHdc(IntPtr hWnd); // 8 byte IntPtr
}
Let suppose these DLLs are included as modules in my csharpdll.dll.
Now if I deploy all these DLLs, how could write a simple nice code in my C# dll which internally target whatever native lib is appropriate?
Is it possible (to keep it simple)?
|
|
|
|
|
I am new to C# and .Net. I am trying to execute a bat file from inside a C# application. I continue to get a security error and no one here can help me out. Any ideas?
Thanks in advance.
tom
|
|
|
|
|
Don't cross post for a start. You've already had several replies, mine included.
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
|
|
|
|
|
Well. I was told here that this may be a .net security issue.
Here is my error message:
Unhandled Exception: System.Security.SecurityException: Request failed.
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly a
sm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, Secur
ityAction action, Object demand, IPermission permThatFailed)
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object ass
emblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle
rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet gran
ts, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Objec
t assemblyOrString, SecurityAction action, Boolean throwException)
at System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack cs
, PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMet
hodHandle rmh, Assembly asm, SecurityAction action)
at ConsoleApplication_uisftp.HelloWorld.Main()
The action that failed was:
LinkDemand
The type of the first permission that failed was:
System.Security.PermissionSet
The demand was for:
<permissionset class="System.Security.PermissionSet"
version="1"
unrestricted="true">
The granted set of the failing assembly was:
<permissionset class="System.Security.PermissionSet"
version="1">
<ipermission class="System.Security.Permissions.EnvironmentPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
read="USERNAME">
<ipermission class="System.Security.Permissions.FileDialogPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
unrestricted="true">
<ipermission class="System.Security.Permissions.FileIOPermission, mscorlib, Vers
ion=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
read="R:\C#2\ConsoleApplication uisftp\ConsoleApplication uisftp\bin\Debug\"
pathdiscovery="R:\C#2\ConsoleApplication uisftp\ConsoleApplication uisftp\bin\De
bug\">
<ipermission class="System.Security.Permissions.IsolatedStorageFilePermission, m
scorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
allowed="AssemblyIsolationByUser"
userquota="9223372036854775807"
expiry="9223372036854775807"
permanent="True">
<ipermission class="System.Security.Permissions.ReflectionPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
flags="ReflectionEmit">
<ipermission class="System.Security.Permissions.SecurityPermission, mscorlib, Ve
rsion=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
flags="Assertion, Execution, BindingRedirects">
<ipermission class="System.Security.Permissions.UIPermission, mscorlib, Version=
2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
unrestricted="true">
<ipermission class="System.Security.Permissions.UrlIdentityPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
url="file:///R:/C#2/ConsoleApplication uisftp/ConsoleApplication uisftp/bin/Debu
g/ConsoleApplication uisftp.exe">
<ipermission class="System.Security.Permissions.ZoneIdentityPermission, mscorlib
, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
zone="Intranet">
<ipermission class="System.Net.DnsPermission, System, Version=2.0.0.0, Culture=n
eutral, PublicKeyToken=b77a5c561934e089"
version="1"
unrestricted="true">
<ipermission class="System.Drawing.Printing.PrintingPermission, System.Drawing,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
version="1"
level="DefaultPrinting">
The assembly or AppDomain that failed was:
ConsoleApplication uisftp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
The Zone of the assembly that failed was:
Intranet
The Url of the assembly that failed was:
file:///R:/C#2/ConsoleApplication uisftp/ConsoleApplication uisftp/bin/Debug/Con
soleApplication uisftp.exe
Press any key to continue . . .
|
|
|
|
|
For a start try running it under an admin account if you can, if that succeeds then it's your permissions that are at fault. Otherwise it's something else which I'm not sure of without looking it up.
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
|
|
|
|
|
Simple Question: Is it possible to restart the .NET framework to simulate a “cold start?” (I.E. similar to restarting your computer and inheritly the framework without restarting your computer.)
If this is possible, how does one accomplish this?
Thank you,
Frank V.
www.TheOpenSourceU.com
|
|
|
|
|
You can't. The Framework is only a set of DLL.
My Blog
|
|
|
|
|
I think that you are correct. You can't. But the framework is more than just DLLs. There is an engine that runs to compile these apps. The 'DLLs' are loaded in to memory (by the engine) and then used through the use of the session. (Until the computer turns off).
I'm looking to unload all of the dlls from memory. And again, I think you are right. you simply cant without restarting and flushing the memory...
Thanks for your response!
Frank V.
http://www.TheOpenSourceU.com
|
|
|
|
|
The .NET framework exists in any process which is running managed code. "Restarting" the framework basically means killing the process and rerunning the managed app.
Josh
|
|
|
|
|
Stop all managed Apps & restart any one of them!
|
|
|
|
|
Why do you want to "cold start .NET Framework"?
Best,
Jun
|
|
|
|
|
I need to simulte a fresh boot cycle (and am trying to save time) so that I can test performance of an application that will only be ran once the computer starts up. Hence, inital load time is important.
Thank you,
Frank V.
|
|
|
|
|
Jawz-X wrote: I need to simulte a fresh boot cycle
An interesting idea, but I am not aware of any such approaches.
Best,
Jun
|
|
|
|
|
Hi,
How would you add a reference to microsoft.xml namespace?? I tried using imports and it comes back with
imports microsoft.visual basic - not giving XML choice?
Many thanks.
|
|
|
|
|