So I built a nice Visual FoxPro application (yep I still like to dabble with FoxPro for simple text file conversions it really is still the best) and I added the config.fpw file in the project under Other - Other Files.
After compiling the project to EXE and everything worked fine in Dev I moved over to UAT and changed the config.fpw file to use UAT configuration but the EXE wasn't working correctly as was still picking up the DEV configuration.
Realised my mistake, the EXE is using the compiled config.fpw first rather than the config.fpw stored on the directory along with the EXE.
I supposed I was so used to adding a Web.Config in a ASP.NET Web Application or an EXE.Config file in a .Net project that hadn't realised it shouldn't be included in the FoxPro Project - doh.
Had the following error appear on a Visual FoxPro Application running under Citrix:-
Error Number: 1957
Error message: Error accessing printer spooler.
I found out that this error was caused because sometimes FoxPro cannot determine the default printer. So a work around was to use the winspool.drv and force FoxPro to the Default Printer name.
Example code as follows (I am defaulting to Win2PDF if no printer is found as this is installed on all our Citrix clients):-
SET PRINTER TO NAME (cDefaultPrinter)
REPORT FORM "TestReport.frx" TO PRINTER PROMPT NOCONSOLE
DECLARE INTEGER GetDefaultPrinter IN winspool.drv;
STRING @ pszBuffer,;
INTEGER @ pcchBuffer
&&Return default printer name
nBufsize = 250
cPrinter = REPLICATE(Chr(0), nBufsize)
= GetDefaultPrinter(@cPrinter, @nBufsize)
cDefaultPrinter = SUBSTR(cPrinter, 1, AT(Chr(0),cPrinter)-1)
lnPrinterCount = APRINTERS(oPrinters)
FOR lnPCount = 1 TO lnPrinterCount
IF oPrinters[lnPCount,1] = 'Win2PDF'
SET PRINTER TO NAME "Win2PDF"