Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Printer Dialog in FPW 2.5
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Divers
Thread ID:
00046794
Message ID:
00046849
Vues:
24
Rodney,
I had experienced the same problem some time ago with a large app written in FPW26. what I ended up doing may seem complicated but that was the only way I could find. SYS(1037) was not the solution since you have no way of telling that the user cancelled the selection.
FPW26 reads WIN.INI to get the printer settings (regardless of the Windows version) so, using GetProfileString and WriteProfileString through Foxtools.fll. I get the printer name, port and driver from the [devices] section in Win.ini into an array aPrinters. The printer dialog (list) is built based on aPrinters. The user selection is used to reference the array row that stores the information about the selected printer, which is fed back to a procedure that will write the device= setting in the [windows] section of Win.ini (that sets the default printer). The report form is then executed, that's when FPW will read win.ini and print the report to the windows default printer.
Make sure that the tag and tag2 fields in the frx file are blank, otherwise the value stored in the tag fields will take precedence over the settings in win.ini.
Still, once in a while we get the error message "Could not allocate global memory" when accessing winapi functions through Foxtools' CallFn(). I couldn't find any fix to that.
Also, there is an article in the MS Knwoledege Base that explains how to use winapi to get ini file settings, but I guess you've gone through that.
As for the hair, it will grow back when you'll move to VFP.

HTH,
Sorin


>I've got a client that won't upgrade their app to 2.6 and we've needed to access the Windows Printer dialog. I utilized some code that I have found using FOXTOOLS using GETPROFILESTRING and WRITEPROFILESTRING, but fairly often they get memory overflow errors. We are also seeing this on multiple machines in our office as well. Has anyone written a "good" printer dialog box for FPW? I also have a need for this in FPW 2.6 unless someone knows of a way to override the selected printer from SYS(1037). I have an application that pre-selects several printers for different reports. If you use SYS(1037) and they select a different printer from default, that printer overrides any printer set in Windows, so the automatic switching of printers within the reporting won't work. It all goes to the last selected printer. This is an aggravating "feature" of FPW. If anyone has any thoughts, I would very much appreciate the ideas. I don't have a lot of hair left to pull out!
>
>Rod Lewis
>MS Consulting, Inc.
>Minneapolis, MN
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform