Torna al Thread

public Form1() { InitializeComponent(); } private MemoryMappedFile mmf; private void Form1_Load(object sender, EventArgs e) { try { mmf = MemoryMappedFile.OpenExisting("COMMTEST"); timer1.Start(); } catch { MessageBox.Show("Applicazione principale non avviata", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void timer1_Tick(object sender, EventArgs e) { Mutex mutex = Mutex.OpenExisting("testmutex"); //mutex.WaitOne(); using (MemoryMappedViewStream stream = mmf.CreateViewStream(1, 0)) { BinaryReader reader = new BinaryReader(stream); double val = reader.ReadDouble(); label1.Text = string.Format("{0}", val); } }
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5