Estimados escribo para consultarles cómo puedo hacer para compilar el siguiente método en C++ en Visual Studio 2002.
¿Que tengo que agregar en el archivo .h y en al archivo .cpp?
Código C++:
Ver originalstatic bool IsPrinterOk(System::String ^printerName);
{
bool bResult=false;
HANDLE hPrinter;
IntPtr pPrinterName=Marshal::StringToHGlobalUni(printerName);
WCHAR *pChar=(WCHAR *)pPrinterName.ToPointer();
if(::OpenPrinter(pChar,&hPrinter,NULL)==0)
return false;
DWORD bytesNeeded;
::GetPrinter(hPrinter,2,0,0,&bytesNeeded);
PRINTER_INFO_2 *pf=(PRINTER_INFO_2 *)GlobalAlloc(GPTR,bytesNeeded);
if(::GetPrinter(hPrinter,2,(LPBYTE)pf,bytesNeeded,&bytesNeeded)!=0)
if(pf->cJobs==0 && pf->Status==0)
bResult=true;
GlobalFree(pf);
ClosePrinter(hPrinter);
return bResult;
}