News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

Using TextOut

Started by xsilvergs, May 03, 2007, 01:22:40 PM

Previous topic - Next topic

xsilvergs

I am trying to get this code to work but get an error message. This draws an X Y axis but I would also like to add some text

      HDC hDC = GetDC(hwndDlg);
      //draw x-axis
      MoveToEx(hDC,0,240,NULL);   //start of line x y
      LineTo(hDC,240,240);         //finish of line x y
      //draw y-axis
      MoveToEx(hDC,10,50,NULL);   //start of line x y
      LineTo(hDC,10,250);         //finish of line x y
      //origin
      TextOut(hDC, 4,245,L"O",1);

It works fine until I add the last line TextOut(hDC, 4,245,L"O",1);

And here is the error message when I Build:

POLINK: error: Unresolved external symbol 'TextOutW'.
POLINK: fatal error: 1 unresolved external(s).

Can somebody please explain/suggest another way of writting text.

Thank you

Tony

Stefan Pendl

Is Gdi32.lib included in the linker options ???
---
Stefan

Proud member of the UltraDefrag Development Team

xsilvergs

It wasn't so I added under "Library and object files:" was that correct?

It didn't make any difference as I still get the same error messages.

frankie

Sounds strange, also because the wingdi.h has the pragma to autoinclude the gdi32.lib.
Please post the project so we'll check.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

xsilvergs

Hi frankie

Hopefully you can see the attached project, I've shortened it a bit.

Thanks

Tony

frankie

Tony your project is for pocketPC, you have to know that the function TextOut doesn't exist for WinCE.
You have to use ExtTextOut. Change yor line:
TextOut(hDC,5,240,L"0",1);
With:
ExtTextOut(hDC, 5, 240, 0, NULL, L"0", 1, NULL);
And it should work.

P.S. for everybody: please specify if your code is for PC or Pocket, and possibly post in the correct thread for pocketPC.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

xsilvergs

frankie

Thank you that works.

Sorry if I posted in the wrong section but I'm still a beginner, probably three weeks playing with C.

All my code so far has been written for ppc and this is one of a few differences.

Thanks again.

Tony