DrawString causes error

Discussions related to Visual Prolog
vjoer
Active Member
Posts: 29
Joined: 7 Feb 2006 13:42

DrawString causes error

Unread post by vjoer » 7 Feb 2013 6:25

Hello

When I try to call the gdiplus function DrawString I get the following error:

Not enough storage is available to process this command.

========================================
Dump: 2013/02/07 06:12:38
----------------------------------------
Exception: nativeCallException (com/visual-prolog/exception/common_exception)

Internal API function call failed

Predicate name = drawString
userMessage = Not enough storage is available to process this command.


API function name = drawString
ErrorCode = 8
ErrorDescription = Not enough storage is available to process this command.


Status code = 2
Message for Status code = InvalidParameter

raised() 2013/02/07 06:12:30
ThreadId=428
ClassInfo: booking/gdiPlus/gdiplusSupport $JustDate: 2010-01-21 $$Revision: 6 $


c:\program files\visual prolog 7.3\pfc\exception\exception.pro(180)

Any idea?

Regards
Viorel Farcas

User avatar
Thomas Linder Puls
VIP Member
Posts: 1635
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 7 Feb 2013 9:52

I think you should pay attention to this part of the exception:
Message for Status code = InvalidParameter
But to be of more help I think we need to see the code that gives the excption.

I assume that you have called gdiPlus::startup:

Code: Select all

predicates     startup : () -> unsigned Token.     startup : (gdiplus_native::gdiplusStartupInput Input) -> unsigned Token.     startup : (gdiplus_native::gdiplusStartupInput Input, gdiplus_native::gdiplusStartupOutput Output [out]) -> unsigned Token.     shutdown : (unsigned Token).
Regards Thomas Linder Puls
PDC

vjoer
Active Member
Posts: 29
Joined: 7 Feb 2006 13:42

Unread post by vjoer » 7 Feb 2013 11:26

Hello Thomas

You have put me on the right track.
The call DrawString does not seem to accept none() as parameter as specified in the Help.
I had therefore to supply some parameters to the call:

Code: Select all

          FillPen = pen::createColor(color::createFromVpiColor(color_Blue), penWidth, unit),         FillBrush = FillPen:brush,                     RR = gdiplus::rectF(X, Y, 200, 200 ),                 Font = font::createFromFontFamily(fontFamily::genericSansSerif, 20, 1, 3),                 Graphics:drawString("AAA", 3, some(Font), RR, none(), some(FillBrush)).

Thanks

Regards
Viorel Farcas

User avatar
Thomas Linder Puls
VIP Member
Posts: 1635
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 8 Feb 2013 10:32

Good.

Could you tell be which argument that could not be none? Then we can update the help (or the code).
Regards Thomas Linder Puls
PDC

vjoer
Active Member
Posts: 29
Joined: 7 Feb 2006 13:42

Unread post by vjoer » 8 Feb 2013 10:35

Hi

For me none() in either Font or Brush triggered the error.

Regards
Viorel Farcas

User avatar
Thomas Linder Puls
VIP Member
Posts: 1635
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 8 Feb 2013 10:51

Thank you. We will look into it.
Regards Thomas Linder Puls
PDC

Post Reply