0

我尝试为本地进程间通信开发匿名管道,参考这篇文章... http://msdn.microsoft.com/en-us/library/bb546102.aspx

我把这两行放在 testApp.cpp

#using <System.dll>
#using <System.Core.dll>

using namespace System;
using namespace System::IO;
using namespace System::IO::Pipes;
using namespace System::Diagnostics;

void testApp::setup() {

}

void testApp:update() {

}

void testApp:draw() {

        Process^ pipeClient = gcnew Process();

        pipeClient->StartInfo->FileName = "pipeClient.exe";

        AnonymousPipeServerStream^ pipeServer =
            gcnew AnonymousPipeServerStream(PipeDirection::Out,
            HandleInheritability::Inheritable);
        // Show that anonymous pipes do not support Message mode.
        try
        {
            Console::WriteLine("[SERVER] Setting ReadMode to \"Message\".");
            pipeServer->ReadMode = PipeTransmissionMode::Message;
        }
        catch (NotSupportedException^ e)
        {
            Console::WriteLine("[SERVER] Exception:\n    {0}", e->Message);
        }

        Console::WriteLine("[SERVER] Current TransmissionMode: {0}.",
            pipeServer->TransmissionMode);

}

他们表明,

"Error:"#using" requires C++/CLI to be enabled

#using <System.dll>,所以,在项目上

Properties->Configuration Properties->General->Common

语言运行时支持,我将其从“无通用语言Runtime支持”更改为“ Common Language Runtime Support (/clr)”。

然后我尝试重建并得到另一个错误是

Command line error D8016: '/ZI' and '/clr' command-line options are incompatible..

现在我完全失去了..

有没有人有关于如何在 0.7.4 上构建匿名管道的解决方案?

提前致谢。

OpenFrameworks 0.7.4 / Visual Studio 2010 / compiler v100
4

1 回答 1

0

Thank you for your comment! I try to use it and got this error....

Unhandled exception at at 0x7591C41F in emptyExample_debug.exe: Microsoft C++ exception: Poco::SystemException at memory location 0x0018F740. 

the code that I debug is this...

void testApp::setup(){

    std::string cmd("bonanza.exe");
    std::vector<std::string> args;
    args.push_back("csa_shogi");
    Poco::Pipe outPipe;
    ProcessHandle ph = Process::launch(cmd, args, 0, &outPipe, 0);
    Poco::PipeInputStream istr(outPipe);

}
于 2013-11-03T11:45:35.877 回答