NO

Author Topic: Using TextOut  (Read 5023 times)

xsilvergs

  • Guest
Using TextOut
« on: May 03, 2007, 01:22:40 PM »
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

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: Using TextOut
« Reply #1 on: May 03, 2007, 03:48:01 PM »
Is Gdi32.lib included in the linker options ???
---
Stefan

Proud member of the UltraDefrag Development Team

xsilvergs

  • Guest
Re: Using TextOut
« Reply #2 on: May 03, 2007, 03:53:23 PM »
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.

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
Re: Using TextOut
« Reply #3 on: May 03, 2007, 08:41:25 PM »
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

  • Guest
Re: Using TextOut
« Reply #4 on: May 03, 2007, 10:22:52 PM »
Hi frankie

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

Thanks

Tony

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
Re: Using TextOut
« Reply #5 on: May 04, 2007, 12:09:06 PM »
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:
Code: [Select]
TextOut(hDC,5,240,L"0",1);With:
Code: [Select]
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

  • Guest
Re: Using TextOut
« Reply #6 on: May 04, 2007, 12:15:48 PM »
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