Article View: borland.public.cppbuilder.nativeapi
Article #15110Re: TPrinter Problem
From: JD
Date: Wed, 16 Jul 2003 00:09
Date: Wed, 16 Jul 2003 00:09
26 lines
1833 bytes
1833 bytes
"Anthony" <endurokarter@yahoo.com> wrote:
> [...] Now that I know the TPrinter::Handle is wrong, can (A)
> be fixed
You can try to change the default printer at runtime (untested):
void __fastcall TForm1::ChangeDefaultPrn( int pIndex )
{
char Device[ 256 ] = { 0 };
char Driver[ 256 ] = { 0 };
char Port[ 256 ] = { 0 };
THandle hDeviceMode;
Printer()->PrinterIndex = pIndex;
Printer()->GetPrinter( Device, Driver, Port, hDeviceMode );
strcat( Device, "," );
strcat( Device, Driver );
strcat( Device, "," );
strcat( Device, Port );
WriteProfileString( "windows", "device", Device );
strcpy( Device, "windows" );
SendMessage( HWND_BROADCAST, WM_WININICHANGE, 0, long( &Device ));
}
~ JD
Technical Details
Message-ID:
<3f1497ce$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!lnewspeer00.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f1460f3$1@newsgroups.borland.com> <3f14693d$1@newsgroups.borland.com> <3f1471c0$1@newsgroups.borland.com> <3f147649$1@newsgroups.borland.com> <3f148037@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,d59131589fe63384 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-07-15 17:39:54 PST From: "JD" <nospam@nospam.com> Sender: "JD" <nospam@nospam.com> Reply-To: "JD" <nospam@nospam.com> Subject: Re: TPrinter Problem Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 172.201.9.240 172.201.9.240 References: <3f1460f3$1@newsgroups.borland.com> <3f14693d$1@newsgroups.borland.com> <3f1471c0$1@newsgroups.borland.com> <3f147649$1@newsgroups.borland.com> <3f148037@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.65 Message-ID: <3f1497ce$1@newsgroups.borland.com> Date: 15 Jul 2003 17:09:50 -0700 X-Trace: newsgroups.borland.com 1058314190 207.105.83.65 (15 Jul 2003 17:09:50 -0700) Lines: 27 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!lnewspeer00.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail