QPrinter::setup()
Simon Rutishauser
simon.rutishauser at web.de
Tue Oct 19 13:05:05 CEST 2004
On Tue, Oct 19, 2004 at 12:46:19PM +0200, Peter Kuemmel wrote:
> Simon Rutishauser wrote:
>
> >Just two hours after writing the first post I found the solution. It is
> >quite weird nevertheless. devmode->dmDeviceName has to be initialized or
> >the other settings in devmode won't be used.
> >
> >I do the initialization via
> > qt_strncpy(devmode->dmDeviceName, QString("").ucs2(), 32);
> >because the other ways I tried to do this it did not work at all. Can
> >someone tell me how I can correctly initialize devmode->dmDeviceName
> >which is a WCHAR[32] or unsigned short [32] array without using this
> >ugly and stupid method?
> >
> >
>
> Hello Simon,
> you could try:
>
> ZeroMemory(devmode->dmDeviceName, 32 * sizeof( TCHAR ) );
> or
> memset( evmode->dmDeviceName, 0, 32 * sizeof( TCHAR ) );
>
> (TCHAR is controlled by the UNICODE macro)
> But is it really more elegant?
>
> Maybe you should use the marco CCHDEVICENAME instead of 32,
> because dmDeviceName is declared as (WinGDI.h):
> ... dmDeviceName[CCHDEVICENAME];
>
> Regards,
> Peter
Thanks. I already found a different solution that seems to be working:
Initialize the QString not with
QString()
as I had done originally but rather with
QString("")
Simon
More information about the kde-cygwin
mailing list