⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pipeclient.cpp

📁 Chapter11-Scalability.rar com example
💻 CPP
字号:
// PipeClient.cpp : Defines the entry point for the application.
//

#include "stdafx.h"

void sub();

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
 	CCPLComInitializer init;

	try {
		sub();
	}catch(_com_error& e) {
		::MessageBox(NULL, CPLGetError(e), NULL, MB_OK);
	}

	return 0;
}

using namespace PIPESVRLib;

_COM_SMARTPTR_TYPEDEF(IPipeLong, __uuidof(IPipeLong));

void DisplayValue(long l)
{
	// do something
}

void sub()
{
	// Instantiate the object
	IUnknownPtr spUnk(__uuidof(MyPipeSvr));

	// Obtain the IPipeLong interface
	IPipeLongPtr spPipe = spUnk;

	// Push data to the pipe
	const int BUFSIZE = 100000;
	LONG buf[BUFSIZE];
	for (long i=0; i<BUFSIZE; i++) {
		buf[i] = i;
	}

	HRESULT hr = spPipe->Push(buf, BUFSIZE);
	if (FAILED(hr)) {
		_com_issue_error(hr);
	}
	::MessageBox(NULL, _T("Sent data"), _T("Client"), MB_OK);
}




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -