1. EzCreateFont failure

I posted this back in April 2004 but never got a response...maybe now?

I wonder if anyone else has run across this.  I have several programs where the
user
can print information.  The first print always works fine but the second and
subseque
nt print fails with:

ezCreateFont: SaveDC failed.

I searched the message archives and saw some mention about ezCreateFont refering
to
resource leaks but that was back in 2002.  

Any help or suggestions would be appreciated.

Jonas

new topic     » topic index » view message » categorize

2. Re: EzCreateFont failure

Jonas Temple wrote:
> 
> I posted this back in April 2004 but never got a response...maybe now?

Sorry.

> I wonder if anyone else has run across this.  I have several programs where
> the user
> can print information.  The first print always works fine but the second and
> subsequent
> print fails with:
> 
> ezCreateFont: SaveDC failed.
> 
> I searched the message archives and saw some mention about ezCreateFont
> refering to
> 
> resource leaks but that was back in 2002.  
> 
> Any help or suggestions would be appreciated.

Don't suppose I can see a (small) source code example of this effect?

-- 
Derek Parnell
Melbourne, Australia

new topic     » goto parent     » topic index » view message » categorize

3. Re: EzCreateFont failure

Derek Parnell wrote:
> > I posted this back in April 2004 but never got a response...maybe now?
> 
> Sorry.

No apologies necessary!

> 
> > I wonder if anyone else has run across this.  I have several programs where
> > the user
> > can print information.  The first print always works fine but the second and
> > subsequent
> > print fails with:
> > 
> > ezCreateFont: SaveDC failed.
> > 
> > I searched the message archives and saw some mention about ezCreateFont
> > refering
> to
> > 
> > resource leaks but that was back in 2002.  
> > 
> > Any help or suggestions would be appreciated.
> 
> Don't suppose I can see a (small) source code example of this effect?
> 
> -- 

I narrowed down the error to the getTextExtent routine and then tried to
work up a small program that demonstrates the error but couldn't come up
with a small program to reproduce the error.

This might be a lot to ask, but if you're willing you could download the
timesheet program I submitted from the archives.  The routine printSheet 
is where the error is happening but only when trying to print twice. At
this point I can't reproduce the error in a small program.  And maybe
that's just it...my timesheet program does quite a bit of printing.

Jonas

new topic     » goto parent     » topic index » view message » categorize

4. Re: EzCreateFont failure

Jonas Temple wrote:
> 
> Derek Parnell wrote:
> > > I posted this back in April 2004 but never got a response...maybe now?
> > 
> > Sorry.
> 
> No apologies necessary!
> 
> > 
> > > I wonder if anyone else has run across this.  I have several programs
> > > where the
> user
> > > can print information.  The first print always works fine but the second
> > > and subsequent
> > > print fails with:
> > > 
> > > ezCreateFont: SaveDC failed.
> > > 
> > > I searched the message archives and saw some mention about ezCreateFont
> > > refering
> > to
> > > 
> > > resource leaks but that was back in 2002.  
> > > 
> > > Any help or suggestions would be appreciated.
> > 
> > Don't suppose I can see a (small) source code example of this effect?
> > 
> > -- 
> 
> I narrowed down the error to the getTextExtent routine and then tried to
> work up a small program that demonstrates the error but couldn't come up
> with a small program to reproduce the error.
> 
> This might be a lot to ask, but if you're willing you could download the
> timesheet program I submitted from the archives.  The routine printSheet 
> is where the error is happening but only when trying to print twice. At
> this point I can't reproduce the error in a small program.  And maybe
> that's just it...my timesheet program does quite a bit of printing.

Ok, I've downloaded your application. The first thing I noticed 
that you have your own modified copy of Win32lib. It has your
'DrawText' routine that uses some of the win32lib local routines.
I've fixed a number of things since your snapshot of the library.

You might like to use the current win32lib with a modified
version of DrawText (see below) added directly in your app
just after the "include win32lib.ew" line.

global function DrawText(atom id, sequence text, atom text_len,
                         sequence format_dim, atom format_opt,
                         object addl_format)
  VOID = text_len
  VOID = addl_format
  return drawText(id, text, format_dim, format_opt, 0,0,0)
end function


This might work. I'm not sure 'cos your app keeps crashing
on different things and I'm wading through fixing those things
too.

For example...

time.exw:2226 in procedure CalendarCC_onChange()
variable date_searched has not been assigned a value

and ...

time.exw:656 in procedure printSheet()
subscript value 6 is out of bounds, reading from a sequence of length 3

-- 
Derek Parnell
Melbourne, Australia

new topic     » goto parent     » topic index » view message » categorize

5. Re: EzCreateFont failure

Actually, the last crash was caused by my hastely written
DrawText() wrapper. This one below actually works..

global function DrawText(atom id, sequence text, atom text_len,
                        sequence format_dim, atom format_opt,
                        object addl_format)
    sequence rtn_val
    VOID = text_len
    VOID = addl_format
    rtn_val = drawText	(id, text, format_dim, format_opt, 0,0,0)
    rtn_val = rtn_val[1..2] & rtn_val[3]
    return rtn_val
end function


-- 
Derek Parnell
Melbourne, Australia

new topic     » goto parent     » topic index » view message » categorize

6. Re: EzCreateFont failure

Now that I'm using a DrawText wrapper that works and I've fixed
a minor bug in your code, it runs just great! No failures in
EzCreateFont() at all.

Please try it using the current win32lib and not your DrawText
routine.

BTW, its a nice application. I might just have a use for it. Do you
take enhancement requests?

-- 
Derek Parnell
Melbourne, Australia

new topic     » goto parent     » topic index » view message » categorize

7. Re: EzCreateFont failure

Derek Parnell wrote:
> 
> Now that I'm using a DrawText wrapper that works and I've fixed
> a minor bug in your code, it runs just great! No failures in
> EzCreateFont() at all.
> 
> Please try it using the current win32lib and not your DrawText
> routine.
> 
Okay, I'll give it a shot.  One question...does your drawText return the 
dimensions of the text that was drawn or attempted to be drawn?  In my 
app I call drawtext without actually printing the text to see if it will
fit on the page (end of page thing).

> BTW, its a nice application. I might just have a use for it. Do you
> take enhancement requests?
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> 
Sorry you had all the trouble with program :( I guess I should have 
remembered that I have updated the program since I posted it way back 
when.  I do have a more recent version but it too had the problem
with EzCreateFont.

I'll post the updated program to RDS and if you have feature requests
other than what I've done I'll be glad to consider them!

Thanks,

Jonas

new topic     » goto parent     » topic index » view message » categorize

8. Re: EzCreateFont failure

Jonas Temple wrote:
> 
> Derek Parnell wrote:
> > 
> > Now that I'm using a DrawText wrapper that works and I've fixed
> > a minor bug in your code, it runs just great! No failures in
> > EzCreateFont() at all.
> > 
> > Please try it using the current win32lib and not your DrawText
> > routine.
> > 
> Okay, I'll give it a shot.  One question...does your drawText return the 
> dimensions of the text that was drawn or attempted to be drawn?  In my 
> app I call drawtext without actually printing the text to see if it will
> fit on the page (end of page thing).

Yes the Win32lib drawText() does return the rectangle used. Its not
documented though (sorry). I ran your app using the win32lib version
and it works just fine.

And naturally enough, I've updated the docs now too.

-- 
Derek Parnell
Melbourne, Australia

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu