>Local loPrtInfo,lnsuccess,lnstructure > >bNeeded=0 >nForms=0 >nSize=0 >nlevel=1 >nBuffSize=0 >loPrtInfo=CreateObject('clsPrinterForms') > >nBuffSize=loPrtInfo.sizeof() >lnStructure=loPrtInfo.GetPointer(nBuffSize) >lnsuccess=WS_EnumForms(lnhand, nlevel , lnStructure , nBuffSize, @bNeeded , @nForms ) > >if lnsuccess = 0 > lmyerr=GetLastError() > lnStructure=loPrtInfo.GetPointer(bNeeded) > nBuffSize=bNeeded > *if lmyerr=122 > lnsuccess=WS_EnumForms(lnhand, nlevel , lnStructure , nBuffSize, > @bNeeded , @nForms ) > *endif >endif > >loPrtInfo.SetPointer(lnStructure) >loPrtInfo.FreePointer(lnStructure) >>When I call WS_Enumforms the first time it returns 0 and bNeeded is 7132. However GetLastError returns 0 and when WS_EnumForms is called again I am instantly back at the DESKTOP. At one point I was getting error 122 - Buffer too small- But I am not even getting that now. Thanks.
lnStructure = 0 nBuffSize = 0 lnsuccess=WS_EnumForms(lnhand, nlevel , lnStructure , nBuffSize, @bNeeded , @nForms )According to MSDN GetLastError should return 122 - Buffer too small in this case.