Author Topic: Invalid Error  (Read 2963 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
Invalid Error
« on: June 11, 2012, 11:31:43 AM »
Deleted
« Last Edit: May 05, 2015, 11:54:31 AM by Peter »

Charles Pegge

  • Guest
Re: Invalid Error
« Reply #1 on: June 11, 2012, 02:40:00 PM »
Hi Peter,

If your prototype is correct then give it the string directly. GDI+ likes to receive a wstring or wchar*

wstring txt="Hello"

status = call GdipDrawString bHdc, txt, Len(txt), Font, tRect, 0, Brush

http://www.jose.it-berater.org/smfforum/index.php?topic=1826.0

Charles

Charles Pegge

  • Guest
Re: Invalid Error
« Reply #2 on: June 11, 2012, 03:54:07 PM »
Are you doing your low-level call stuff, Peter?

@trect
« Last Edit: June 11, 2012, 04:30:42 PM by Charles Pegge »

Peter

  • Guest
Re: Invalid Error
« Reply #3 on: June 12, 2012, 02:29:41 AM »
And @tREct crashed.

Charles Pegge

  • Guest
Re: Invalid Error
« Reply #4 on: June 12, 2012, 02:55:50 AM »
Hi Peter,

From projects/GDIWindow/WaterFallJpg2.o2bas

 extern library "gdiplus.dll"
  '
  long GdiplusStartup( dword *token, GdiplusStartupInput*input,  GdiplusStartupOutput *output)
  long GdiplusShutdown(dword*token)
  long GdipLoadImageFromFile(wstring filename, sys*image)
  long GdipCreateBitmapFromFile(wstring filename, sys*bitmap)
  long GdipCreateHBITMAPFromBitmap(sys bitmap, sys*hbmReturn, dword backgroundColor)
  long GdipDisposeImage(sys image)
  '
  long GdipCreateFromHDC( sys hdc, *pGraphics)
  long GdipGraphicsClear(sys graphics,argb)
  long GdipDeleteGraphics(sys graphics)
  '
  long GdipBitmapGetPixel (sys image,x,y,*argb)
  long GdipBitmapSetPixel (sys image,x,y,argb)
  long GdipDrawImageRectI(sys graphics,image,x,y,w,h)
  long GdipCloneBitmapAreaI(sys x,y,width,height,PixelFormat,srcBitmap,dstBitmap)
  '
  long GdipCreateSolidFill(sys argb, *brush)
  long GdipSetSolidFillColor(sys brush, argb)
  long GdipGetSolidFillColor(sys brush, *argb)
  long GdipDeleteBrush(delete brush)
  long GdipCreatePen1(sys argb, single width, GpUnit unit, sys *pen)
  long GdipCreatePen2(sys brush, single width, GpUnit unit,sys *pen)
  long GdipGetPenWidth(sys pen, single width)
  long GdipSetPenColor(sys pen,argb)
  long GdipDeletePen(sys pen)
  '
  long GdipDrawLineI(sys graphics, pen,x1,y1,x2,y2)
  long GdipDrawRectangleI(sys graphics, GpPen pen, x, y,width,height)
  long GdipDrawEllipseI(sys graphics, pen,x,y,width,height)
  long GdipFillRectangleI(sys graphics,brush,x,y,width,height)
  long GdipFillEllipseI(sys graphics,brush,x,y,width,height)
  '
  long GdipNewInstalledFontCollection(sys * fontCollection);
  long GdipCreateFontFamilyFromName(wstring name,sys fontCollection,*FontFamily)
  long GdipDeleteFontFamily(sys FontFamily)
  long GdipCreateFont(sys fontFamily,single emSize,GpFontStyle style,GpUnit unit,sys *font)
  long GdipDeleteFont(sys font)[/b]
  '
 long GdipDrawString(sys graphics,wstring ws,sys length,font,RECTF *layoutRect,sys stringFormat,brush)

  '
  end extern


pointf is a floating point rect
all strings must be wide ie: wstring or wchar*


  type RECTF single x,y,w,h
GdipDrawString pGraphics,wtxt,-1,font,pointf,0,FontBrush


Charles
« Last Edit: June 12, 2012, 03:10:06 AM by Charles Pegge »

Charles Pegge

  • Guest
Re: Invalid Error
« Reply #5 on: June 12, 2012, 03:52:09 AM »

Peter,

Could you try reverse-engineering that example to your own requirements. I believe it has most of what you need, and I think it would save you a lot of pain.

It is so much easier to start from a working example.

projects/GDIWindow/WaterFallJpg2.o2bas

Charles

Charles Pegge

  • Guest
Re: Invalid Error
« Reply #6 on: June 12, 2012, 05:49:24 AM »

I recommend a Siesta, Peter.  8)