資源簡介
通過命名管道實現了C#及C++進程的通信,并支持復制類型數據結構的傳輸.

代碼片段和文件信息
using?System;
using?System.Runtime.InteropServices;
namespace?IPC
{
????///?
????///?Format?an?object?to?byte?array
????///?
????public?static?class?objectToByteArray
????{
????????///?
????????///?Format?an?object?to?byte?array
????????///?
????????///?
????????///?byte?array
????????public?static?byte[]?ToByteArray(this?object?o)
????????{
????????????int?size?=?Marshal.SizeOf(o);
????????????byte[]?buffer?=?new?byte[size];
????????????IntPtr?p?=?Marshal.AllocHGlobal(size);
????????????try
????????????{
????????????????Marshal.StructureToPtr(o?p?false);
????????????????Marshal.Copy(p?buffer?0?size);
????????????}
????????????finally
????????????{
????????????????Marshal.FreeHGlobal(p);
????????????}
????????????return?buffer;
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????11600??2011-04-08?15:29??IPCDemo\IPC\bin\Debug\IPC.vshost.exe
?????文件???????2637??2011-04-08?15:19??IPCDemo\IPC\IPC.csproj
?????文件???????7895??2011-04-08?15:18??IPCDemo\IPC\NamedPipe\NamedPipe.cs
?????文件????????777??2011-04-08?15:18??IPCDemo\IPC\NamedPipe\NamedPipeClient.cs
?????文件????????654??2011-04-08?15:18??IPCDemo\IPC\NamedPipe\NamedPipeServer.cs
?????文件???????5810??2011-04-08?15:27??IPCDemo\IPC\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件????????877??2011-04-08?15:19??IPCDemo\IPC\ob
?????文件????????904??2011-04-08?15:22??IPCDemo\IPC\Program.cs
?????文件???????1418??2011-04-08?15:15??IPCDemo\IPC\Properties\AssemblyInfo.cs
?????文件???????1972??2011-04-08?15:29??IPCDemo\IPCClient\Debug\IPCClient.Build.CppClean.log
?????文件????????419??2011-04-08?15:29??IPCDemo\IPCClient\Debug\IPCClient.log
?????文件???????3991??2011-03-30?16:48??IPCDemo\IPCClient\IPCClient.vcxproj
?????文件???????1080??2011-03-30?16:48??IPCDemo\IPCClient\IPCClient.vcxproj.filters
?????文件????????143??2011-03-30?15:35??IPCDemo\IPCClient\IPCClient.vcxproj.user
?????文件???????1866??2011-04-08?15:21??IPCDemo\IPCClient\main.cpp
?????文件????????318??2011-03-30?16:46??IPCDemo\IPCClient\memory_leak.h
?????文件???????4031??2011-04-08?15:22??IPCDemo\IPCDemo\IPCDemo.vcxproj
?????文件???????1080??2011-03-30?16:48??IPCDemo\IPCDemo\IPCDemo.vcxproj.filters
?????文件????????143??2011-03-30?14:34??IPCDemo\IPCDemo\IPCDemo.vcxproj.user
?????文件???????2796??2011-04-08?15:26??IPCDemo\IPCDemo\main.cpp
?????文件????????318??2011-03-30?16:47??IPCDemo\IPCDemo\memory_leak.h
?????文件???????3469??2011-04-08?15:17??IPCDemo\IPCDemo.sln
????..A..H.?????41472??2011-04-08?15:29??IPCDemo\IPCDemo.suo
?????目錄??????????0??2011-04-08?15:15??IPCDemo\IPC\obj\x86\Debug\TempPE
?????目錄??????????0??2011-04-08?15:29??IPCDemo\IPC\obj\x86\Debug
?????目錄??????????0??2011-04-08?15:29??IPCDemo\IPC\bin\Debug
?????目錄??????????0??2011-04-08?15:16??IPCDemo\IPC\bin\Release
?????目錄??????????0??2011-04-08?15:15??IPCDemo\IPC\obj\x86
?????目錄??????????0??2011-04-08?15:16??IPCDemo\IPC\bin
?????目錄??????????0??2011-04-08?15:15??IPCDemo\IPC\NamedPipe
............此處省略10個文件信息
評論
共有 條評論