Hi again,
I use BDS2006
The fix for pascal is at http://qc.borland.com/wc/q
and is:
1. Add two printers to the windows printers confioguration.
2. Change the default-settings for the NON default printer.
3. Set runtime in a delphi application the PrinterIndex to the NON default printer.
4. Then the default-settings of this printer aren't loaded.
---------
An example of a solution :
procedure SetPrinterIndex(Value: Integer);
procedure TPrinter.SetPrinterIndex(V
// ----- Begin NEW PART -----
var
lDevice, lDriver, lPort : Array[0..255] of Char;
lDeviceMode : Cardinal;
// ----- End NEW PART -----
begin
CheckPrinting(False);
if (Value = -1) or (PrinterIndex = -1) then
begin
SetToDefaultPrinter;
end else begin
if (Value < 0) or (Value >= Printers.Count) then RaiseError(SPrinterIndexEr
// ----- Begin NEW PART -----
Printer.GetPrinter(lDevice
GlobalUnlock(lDeviceMode);
GlobalFree(lDeviceMode);
lDeviceMode := 0;
Printer.SetPrinter(lDevice
// ----- End NEW PART -----
end;
FPrinterIndex := Value;
FreeFonts;
SetState(psNoHandle);
end;
// Additional comment (Bruno Sonnino)
This bug is still in Delphi 7 and also affects the Devmode that is passed to CreateDC/CreateIC in TPrinter.SetState (The Devmode for the default printer is always passed). The proposed fix, putting the line:
FPrinterIndex := Value;
before the fix (and not after, as it's shown), fixes also this problem.
I could find the SetPrinter routine as part of the C++ TPrinter functions
Thanks
Larry
Main Topics
Browse All Topics





by: gtokasPosted on 2007-04-28 at 17:39:47ID: 18995812
>> use borland c++ builder latest version
BDS2006??
Turbo C++ Builder??
>>I have seen the fixes for Delphi
Post the fix here and I will try to translate it for BCB...
George Tokas.