|
Stephan Wright wrote:
I tried to add a kind of counter in the method but it did not work.
By design it wont. No data is shared between application, unless u use remoting to connect to them.
Stephan Wright wrote:
My application is called via the Process.Start() command.
Give the process a name or some ID , and enumerate thru all the processes before starting yours.
top secret xacc-ide 0.0.1
|
|
|
|
|
Hi stephan,
Firstly, i'm sure there is a better way of doing it than this but one of the programmes we use at work does it this way and it works for us, it creates a "Lock" file.
When the instance loads it first checks for this lock file, if it doesn't exist the program loads and creates the lock file, if the file already exists then an instance is already running so the program can just display an error and shut down.
When the instance finishes running just delete the lock file.
Like i said, not the best way of doing it and i'm sure someone will post the correct way to check but this is simple and as long as it's implimented correctly it will be effective.
Kev Pearman MCP
|
|
|
|
|
|
Using a mutex is more common to solve such a problem, as the next reply after yours recommended. Lock files can lead to problems, especially when they're not cleaned-up appropriately (i.e., the CLR crashes because of problems in the application).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Is the app you are calling a C# app and you have the code,
If so, you could use a mutex to prevent a further instance of your app running.
See this article[^]
A google search for single instance mutex will return more results.
Michael
CP Blog [^]
|
|
|
|
|
thanks this solved my problem! Now it works!
Stephan.
|
|
|
|
|
Hi all,
I'd like to create a service running in the background on a client's computer to monitor various actions of the user, such as:
Logging URL's visited
Logging files downloaded etc ...
I was first going to use a Browser Helper Object to do this but then discovered that it would only work with Internet Explorer and not other browser types. I also discovered that a lot of marshalling would have to occur especially using the languange C#.
I would now like to code a firewall instead to log the various user actions. How would i go about doing this ? ... Any code or reference sites would be much appreciated.
Thank you for your time
|
|
|
|
|
|
I'm currently a student thats studying and i have to create this application as a 4th year project, so i have to physically code a application.
Any help will be very much appreciated ...
|
|
|
|
|
Then code a log analyzer. .NET is too high-level, as I said in my email, for such a task. Software firewalls must be integrated at a very low level with Windows, something that C/C++ is more suited for. A firewall must be very efficient and must hook the internet connections in Windows, which also works differently on different Windows platforms.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Even writing the firewall will require a ton of marshalling and P/Invoking...
C# and VB.NET are too high a level for the projects your coming up with. A firewall app would be better written in C++. Maybe not the entire app, but the filtering engine would definately be C++, maybe even Managed C++. You could write management interface for the engine in C# though.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Gurus!
I created a web application in C# but when I created a new Setup project and add all files and outputs I desired I got a wariing massage when I selecting Build->Batch build->Rebuild all. The warning messge is
"Unable to build folder named Admin"
So does any of you knows what's happening? Please give some solution to build my setup project...
Thanx.
xedom developers team
|
|
|
|
|
I pick off this topic because I found solution here
http://www.dotnet247.com/247reference/msgs/48/244282.aspx
xedom developers team
|
|
|
|
|
in my C# app, i want to import somefuntions from win32 dll.
look like this:
[Dllimport("own.dll")]
public static extern void function();
then use the function().
i want to get the own.dll 's handle like LoadLibrary("own.dll") in VC++.
but HOW ?
and if i import 2 or more functions from defferent win32 dll, HOw to get their
handles respectivly ?
and last question: HOW to free the DLL like FreeLibrary do ?
|
|
|
|
|
fu0 wrote:
i want to get the own.dll 's handle like LoadLibrary("own.dll") in VC++.
but HOW ?
[DllImport("kernel32.dll", CharSet=CharSet.Auto)]
static extern IntPtr LoadLibrary(string lpFileName);
[DllImport("unmanaged.dll")]
static extern int YourFunction(int i);
string path = @"..\somedir\own.dll";
IntPtr ptr = LoadLibrary(path);
int i = YourFunction(7);
In .NET 2.0 you will be able to do this:
[DllImport("kernel32.dll")]
internal static extern IntPtr LoadLibrary(String dllname);
[DllImport("kernel32.dll")]
internal static extern IntPtr GetProcAddress(IntPtr hModule, String procname);
internal delegate int MyMsgBox(IntPtr hwnd, [MarshalAs(UnmanagedType.LPWStr)]String text, [MarshalAs(UnmanagedType.LPWStr)]String Caption, int type);
IntPtr user32 = LoadLibrary("user32.dll");
IntPtr procaddr = GetProcAddress(user32, "MessageBoxW");
MyMsgBox msgbox = (MyMsgBox)Marshal.GetDelegateForFunctionPointer(procaddr, typeof(MyMsgBox));
msgbox(IntPtr.Zero, "Hello, World", "A Test Run", 0);
- Nick Parker My Blog | My Articles
|
|
|
|
|
THanks for your suggestion!!
|
|
|
|
|
hello,
I have created a dynamic textbox in an asp.net and fill the value dynamically. But the value doesn't show up on the page. I think system has overwrite the value on my dynamic textbox.
I tried to trace the textbox. But couldn't do it. Can anyone give me the best way to trace the textbox. or if I can set a break point for my dynamic textbox.
any suggestion will be appreciated.
Thanks, Suds
======
You need a head to program. Cool, fast and sharp.
|
|
|
|
|
|
sorry!
======
You need a head to program. Cool, fast and sharp.
|
|
|
|
|
how to use COM which written by visual c++ ATL?
|
|
|
|
|
|
how can i disable the task manager from my program
|
|
|
|
|
You can do it thought the registry. Or, I guess you could mess around with the taskman executable in the sys dir or somewhere...
/\ |_ E X E GG
|
|
|
|
|
But, the real question is: Is that really all that wise?
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
Do I have to answer?
/\ |_ E X E GG
|
|
|
|