未在此范围内声明“XcvData”

时间:2013-03-13 23:00:50

标签: c++ qt

我正在尝试安装带有Ghostscript和RedMon的虚拟打印机,使用c ++打印到PDF文件,但是当我尝试编译我的代码时,我在下面的函数中得到了'XcvData' was not declared in this scope

#include <windows.h>
#include <winspool.h>
BOOL AddPort()
{
    DWORD cbneed,cbstate;
    PBYTE pOutputData;
    HANDLE hXcv = INVALID_HANDLE_VALUE;
    PRINTER_DEFAULTS Defaults = { NULL,NULL,SERVER_ACCESS_ADMINISTER };

    WCHAR pszPortName[]=L"UTReportPDFPort:";
    pOutputData=(PBYTE)malloc(MAX_PATH);

    if(!OpenPrinter((WCHAR*)",XcvMonitor Redirected Port",&hXcv,&Defaults ))
    {
        LPVOID lpMsgBuf;
        GetLastError();
        FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
            NULL, GetLastError(), NULL,(LPTSTR) &lpMsgBuf, 0, NULL );
        ::MessageBox(0,(LPCTSTR)lpMsgBuf,(WCHAR*)"ERROR",MB_OK|MB_ICONINFORMATION);
        free(pOutputData);
        LocalFree( lpMsgBuf );
        return FALSE;

    }
    if(!XcvData(hXcv,L"AddPort",(PBYTE)pszPortName,sizeof(pszPortName),(PBYTE)pOutputData,MAX_PATH,&cbneed,&cbstate))
    {
        LPVOID lpMsgBuf;
        SetLastError(cbstate);
        FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
              NULL, GetLastError(), NULL,(LPTSTR) &lpMsgBuf, 0, NULL );
        ::MessageBox(0,(LPCTSTR)lpMsgBuf,(WCHAR*)"ERROR",MB_OK|MB_ICONINFORMATION);
        LocalFree( lpMsgBuf );
        free(pOutputData);
    }

    free(pOutputData);
    ClosePrinter(hXcv);

    return TRUE;

}

在Qt应用程序中使用XcvData函数可以做些什么?

0 个答案:

没有答案