Y
yusen_chen
Guest
"Exception Settings -> Win32 Exception" need to check above.
Run the sample code on .exe for the first time, Microsoft Visual Studio will thrown a exception "RPC_S_SERVER_UNAVAILABLE(0x000006BA)",but can continue to next step.
Does anyone one have the same problem ?
I dont know how to modify code. I look forward to your help.
The C++ sample code is as following:
CString csPrinterName = L"OneNote"; //printer name
std::unique_ptr<DEVMODE> pDevMode;
HANDLE hPrinter = NULL;
LPWSTR lpWstr = csPrinterName.GetBuffer(csPrinterName.GetLength());
if :OpenPrinter(lpWstr, &hPrinter, NULL))
{
long lnSize = :ocumentProperties(NULL, hPrinter, lpWstr, NULL, NULL, 0); //thorwn RPC_S_SERVER_UNAVAILABLE(0x000006BA),but can continue to run
if (lnSize > 0)
{
pDevMode.reset((DEVMODE*)new BYTE[lnSize]());
if (pDevMode)
{
pDevMode->dmSize = (unsigned short)lnSize;
lnSize = :ocumentProperties(NULL, hPrinter, lpWstr, pDevMode.get(), NULL, DM_OUT_BUFFER);
if (lnSize != IDOK)
{
pDevMode.reset();
}
}
}
::ClosePrinter(hPrinter);
}
csPrinterName.ReleaseBuffer();
Continue reading...
Run the sample code on .exe for the first time, Microsoft Visual Studio will thrown a exception "RPC_S_SERVER_UNAVAILABLE(0x000006BA)",but can continue to next step.
Does anyone one have the same problem ?
I dont know how to modify code. I look forward to your help.
The C++ sample code is as following:
CString csPrinterName = L"OneNote"; //printer name
std::unique_ptr<DEVMODE> pDevMode;
HANDLE hPrinter = NULL;
LPWSTR lpWstr = csPrinterName.GetBuffer(csPrinterName.GetLength());
if :OpenPrinter(lpWstr, &hPrinter, NULL))
{
long lnSize = :ocumentProperties(NULL, hPrinter, lpWstr, NULL, NULL, 0); //thorwn RPC_S_SERVER_UNAVAILABLE(0x000006BA),but can continue to run
if (lnSize > 0)
{
pDevMode.reset((DEVMODE*)new BYTE[lnSize]());
if (pDevMode)
{
pDevMode->dmSize = (unsigned short)lnSize;
lnSize = :ocumentProperties(NULL, hPrinter, lpWstr, pDevMode.get(), NULL, DM_OUT_BUFFER);
if (lnSize != IDOK)
{
pDevMode.reset();
}
}
}
::ClosePrinter(hPrinter);
}
csPrinterName.ReleaseBuffer();
Continue reading...