Home > Software engineering >  Consult the problem using we Shared between processes
Consult the problem using we Shared between processes

Time:10-09

I did a Windows service program, colleagues also comes with a FORM of console interface, hope the console program can and Windows service to communication, so want to use the System. IO. MemoryMappedFiles. We to share data under the

But I am the same code on the two form program results can be Shared, but on the Windows service procedure, the result is always prompt, cannot find the file address
Is a Windows service application Shared memory, there is no access to the form?
I am a Windows 7 system

Create:
Dim MF As System. IO. MemoryMappedFiles. We.=we CreateNew (50000) "testmap,"
Dim buf (4) As Byte
As Single Dim s
Dim As ms System. IO. MemoryMappedFiles. MemoryMappedViewStream
Ms=MF. CreateViewStream
S=Rnd ()
Buf=BitConverter. GetBytes (s)
Ms. Write (buf, 0, buf. Length)

Read:
Dim MMF As we=we OpenExisting (" testmap ")

Dim bufa () As Byte={0, 0, 0, 0, 0}
Dim As ms System. IO. MemoryMappedFiles. MemoryMappedViewStream
Ms=MMF. CreateViewStream
Ms. Read (bufa, 0, bufa Length)
TextBox1. Text=BitConverter. ToSingle (bufa, 0)
  • Related