Hello,
I created a new Windows Forms .NET project. Then into the Form1 class in
Form1.H , I defined a public-signatured static Mutex object as below:
....
public __gc class Form1 : public System::Windows::Forms::Form
{
public: static System::Threading::Mutex *mt = NULL;
...
}
Then, into the main function of application that starts the program, I coded
blow statements:
#include "stdafx.h"
#include "Form1.h"
using namespace RunOnlyOnceAtATime;
[System::STAThreadAttribute]
void __stdcall _tWinMain()
{
Form1::mt = new System::Threading::Mutex(false, "myMutex");
if (!Form1::mt->WaitOne(10, true))
{
// Another copy of program is running
MessageBox::Show(S"Program is already running.", S"Working Program");
return;
}
else
{
//Run application.
Form1::mt->WaitOne();//Yalnızca bu çalışıyor mutexi kilitliyelim
Application::Run(new Form1());
}
}
Above codes solved my problem. Thank you very much.

Signature
~~~~~~~~~~~~~~~~~~~
İyi Çalışmalar
Alper AKÇAYÖZ (Bil Muh)
Wish You Good Work
Alper AKCAYOZ (Bil Muh)
> > Hello,
> > I have developped an application used by Windows Forms (.NET) at Visual C++
[quoted text clipped - 15 lines]
> Ronald Laeremans
> Visual C++ team