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

📄 printrequest.cpp

📁 window下的多线程编程参考书。值得一读
💻 CPP
字号:
#include <stdio.h>
#include "CMcl.h"

#define MAX_REQUEST_SIZE            (MAX_PATH + 1)
#define PRINT_REQUEST_MAILBOX_NAME  __TEXT("MclTestPrintServerMailbox")

int main(int argc, char *argv[]) {
    // request that a document be printed by invoking this
    // program with the filename as the first command line parameter...

    // open the print server mailbox object...
    // notice that the mailbox must already exist for this to work...
    CMclMailbox m_cmRequests(PRINT_REQUEST_MAILBOX_NAME);

    // check the status of the mailbox...
    if (m_cmRequests.Status() != NO_ERROR) {
        printf( "Unable to open print request mailbox.\n");
        return -1;
    }

    // format a request...
    BYTE abRequest[MAX_REQUEST_SIZE];
    ZeroMemory( abRequest, MAX_REQUEST_SIZE);
    strncpy( (char *) abRequest, argv[1], MAX_REQUEST_SIZE);

    // post the request...
    if (m_cmRequests.Post( abRequest, INFINITE)) {
        printf( "Print request submitted.\n");
    }
    else {
        printf( "Unable to submit print request.\n");
        return -1;
    }

    return 0;
}

⌨️ 快捷键说明

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