|
I believe that "shared" just means that multiple applications share the dll, where each application loads the library local to the app.
You could write the last number to a file from the library, and read that when the function gets called
I are troll
|
|
|
|
|
But a DLL is a library - not an instance - so it doesn't contain variables that can be amended. When app A calls the Increment() method, it creates an instance of that class in its own AppDomain (unless you specify otherwise). App B would do the same. To solve this you'd need to create a separate app / service, app C which app A and app B can remote to.
It definitely isn't definatley
|
|
|
|
|
Remote how? Via a socket or something - I want it to be ultra fast.
Look here is some blurb from the Windows Open Services Architecture used by ODBC etc. How can I do this stuff in C#?
-----------
The WOSA model consists of three distinct pieces. Each of these pieces plays an important, and independent, role in providing programming services to your applications. The three WOSA components are
The Client API-the application programming interface used by the program requesting the service.
The Server SPI-the service provider interface used by the program that provides the extended service (for example, e-mail, telephony, speech services, and so on).
The API/SPI Interface-the single module that links the API and SPI calls. This is usually implemented as a separate DLL in the Windows environment.
...
Since a key design aspect of WOSA is the isolation of the client API and the server SPI, a single interface between the two components is required. This single interface is usually implemented as a Windows dynamic link library (DLL) that allows programs to link to existing services at run-time instead of at compile time....
...
Please don't tell me like the last guy who posted here that i should write to a file and then poll it from the server thread etc. This is a common task how is it done properly in C#?
|
|
|
|
|
Obviously there's a number of different solutions you could use. For example, you could have a shared database containing a table with a single column which contains a single value (the value you're tracking). If the database exposes a stored procedure to increment the value (using a transaction of course) and returns the newly updated value, the database transation will take care of the concurrency issue automatically for you. If you've not got a database in your application this would more than likely be overkill.
Sockets would probably be the quickest way to go - a quick google[^] should get you started. I'd also thoroughly recommend getting hold of a decent .NET book - 'Pro C#' by Andrew Troelsen is an excellent reference.
Good luck!
It definitely isn't definatley
|
|
|
|
|
No I need it very fast I already said that - far far faster than sockets. I want to have a windows service running, working in the background, and I want various clients to be able to call into that service using a DLL that returns in under one microsecond.
I only need access from C# and want to know how to do this interprocess communication.
Does anyone know how to do this properly? Maybe each client can load the DLL into the AppDomain used by my server for example and thus end up with a common instance in a common app domain...
modified on Tuesday, March 24, 2009 3:22 PM
|
|
|
|
|
You never even looked at any of the links, did you?! In .NET, assemblies aren't hosted directly within a process (unlike win32 apps which are). Instead, they're hosted by a partition in a process called an AppDomain. One AppDomain can't access data of any kind (global or static fields) from another AppDomain without using remoting (or resorting to using pinvoke and doing some win32 programming). Maybe you should go and do some research about the topic yourself?
Have you even done any tests to figure out how quick a solution using sockets or a database would be? Didn't think so...
It definitely isn't definatley
modified on Tuesday, March 24, 2009 1:54 PM
|
|
|
|
|
|
I've had a look at the code in the first link you sent - it's not particularly complicated (though I'd still recommend you do some research on AppDomains) but still relies on the scenario I described in my first email where you would need a third app ('app C') which would need to be running (this is the AppDomain you would be searching for).
However, you've still not given any reasoning or scenario behind why you need to do it this way. What sort of load are you expecting? Is this a shared counter for multiple applications on a single box? What makes you think that the other solutions described are too slow for what you need (have you done any benchmarking yourself?).
If you try and give some more detail you might get something more useful in response.
It definitely isn't definatley
|
|
|
|
|
I think I have said several time that I will have a windows service running which i want to client to talk to. There are no other computers involved, no security issues etc. All I want is the fatest possible performance. The article looks to be doing that but it's very complicated. Another good article is:
http://www.codeproject.com/KB/threads/fast_ipc.aspx?fid=322183&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=2314676[^]
From that article:
IPC (Inter Process Communication) has been covered by many other articles, so there is no real need for 'another' IPC article to show how to implement IPC. However, there was a severe lack of information of how to implement a fast IPC class. This is the purpose of this article.
Due to the availability of information already out there on IPC implementation, I will not dive too deeply on the inner workings of how to implement IPC, but will concentrate on how to make them very fast.
There are several ways to implement an IPC, here are just a few:
Shared memory
Named Pipe
TCP
MSMQ (Microsoft Queue Solution)
File Mapping
Mailslots
With so many choices, how is one to know the fastest? The answer is simple, there is no ideal fastest solution to the problem. Each has its advantages and disadvantages, but one most definitely stands out above the others....... Shared Memory.
---------------
I am just after someone to point me in the right direction. It's pretty obvious what I want... ideally a single instance of the DLL shared by all applications from clients to server... maybe this shared memory example is basically the same thing...
modified on Wednesday, March 25, 2009 6:16 AM
|
|
|
|
|
Checking back you did say that you wanted a windows service - but just once, not 'several time' [sic].
However, you're referencing an article which is written in c++ which has direct memory management unlike 'vanilla' c#. You've not answered the questions I posed about load or the question about benchmarking of other implementations so you're obviously either not prepared to do the research yourself or lack the necessary skills to perform such a task.
You're on your own.
It definitely isn't definatley
|
|
|
|
|
Hi,
I got my webservice running at Apache server and that got certificate integrated.
I want to access from C# windows application as a https call but it is saying
"The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."
How can i by-pass this and make to work.
Thanks in advance ...
|
|
|
|
|
Hi,
How to open a NEW web browser from windows application?
Thankyou
YPKI
modified on Tuesday, March 24, 2009 6:47 AM
|
|
|
|
|
you can start an application with...
System.Diagnostics.Process.Start("filepath");
so you can specify the web browsers filepath.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Do as musefan said - additionally, you can specify a url or even about:blank and it will open it with the default web browser.
System.Diagnostics.Process.Start("about:blank");
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hmmmmm.... says modified but silly me forgot to take a screen shot of your OP so I dont know what has changed. Is it the 'NEW'? If your problem has not been solved why dont you try replying to one of the other posts specifying your requirements?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi all!
I have a little question.
I have c# working program, and i want to localize it. I read about the localization and language properties, but it's not useful for me. i don't want to do it hard coded.
I want to support many languages and that the user can choose his language. I thought to do that with XML files.
Is there any way to get all the static strings from all the forms in one click?! Or an other easy way?
my program is with lots of forms.
Thanks,
Guy.
|
|
|
|
|
1. Set the language property of form to desired language
2. Change the strings on the forms to chossen language.
3. New language specific resource dll will be created and used if the language settings are set in windows enviornment
|
|
|
|
|
thanks for ur answer.
there is a faster way to get all the strings without pass all the forms?
|
|
|
|
|
Hi,
I have texts such as the following...
"EUR50,000 (Wholesale)"
or
"USD 1,000 - Retail"
...
...
...
How do I just pull out the text i.e. (Wholesale)
or Retail ?
I am using this at present and it seems to work if there is brackets around but not if there is "-"
_strRetailWholeSale = strValues.Substring(intPos, strValues.Length - intPos).Trim()
Thanks
|
|
|
|
|
Use Regular Expressions, it will help you out.
|
|
|
|
|
Check this out this regular exp:
@"(\([a-zA-Z]+\))|(\s?-\s?[a-zA-Z]*)"
This might help u out.
|
|
|
|
|
well if your two examples are the only types it could be i would split the string with spaces, then get the last string in the resulting array. Then you just need to remove brackets if need be. Something like...
string[] results = inputString.Split(' ')'
string result = result[result.Length-1].Replace("(", "").Replace(")", "");
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hello everybody.
I hope some of you can help me with this problem with CSV Reader. I have a text file contains
"USER\FIRSTNAME";"DOMAINNAME"
"User1";"USER\Admin"
I am using LumenWorks.Framework.IO.Csv (CSV Reader) to "read" my text file, but I got the output wrong. The CSV reader removes the \ from my text file.
the output is like this
USERFIRSTNAME;DOMAINNAME
User1;USERAdmin where it should be
USER\FIRSTNAME;DOMAINNAME
User1;USER\Admin
If i remove the double qoute from my text file, then I get the right output. Has any of you run in to this issue, or could any one explains to me how I can fix this issue??
Any advice will be grateful. Many thanks in advance!!
|
|
|
|
|
Hey again,
I found a solution for my problem. It to have " and ' in CSVReader class, then it works
|
|
|
|
|
I have a problem, I use PictureBox es to display a source image in 32x32 pixel chunks.
The are added to a FlowLayoutPanel 's Controls property.
Now I want the user to be able to select several at the same time (up to 25), I try to do that by using the MouseDown and stopping the seletion at the MouseUp event (miraculously it fixed itself and the MouseUp even works right now).
My problem is that the user can still select not neighboring PictureBox es, but can hold the mous button down, move around to completely unrelated PictureBox es on the other edge of the FlowLayoutPanel and add these to the selection, because the MouseUp event didn't get fired yet.
How do I prevent the user from selecting PictureBox es that are not next to each other?
I tried it with the MouseLeave event both, but the PictureBox es' event fires the moment you leave a single of them, preventing any selection of more than 1 and the FlowLayoutPanel 's event is inaccessible when I fill all of it with PictureBox es.
I also tried to check the Cursor position, but that fires seemingly randomly and I can't debug it (during debug the cursor position isn't fixed at the last position the cursor had in your program, but will change according to the position in VS).
|
|
|
|