CE problem: Cannot use DrawText() or SetWindowText()

Post Reply
itouch
Posts: 54
Joined: Mon Jul 27, 2009 5:20 am

CE problem: Cannot use DrawText() or SetWindowText()

Post by itouch » Wed Sep 30, 2009 9:36 am

I am using the latest CE release and am having this strange problem where DrawText() in general, and SetWindowText() on static controls will not work. I can see my menu entries, dialog box text controls and even listbox entries that I create.

For example, this simple piece of code will not work:

case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
GetClientRect(hWnd, &r);
SetBkMode(hdc, OPAQUE);
SetBkColor(hdc, RGB(255, 255, 255));
SetTextColor(hdc, RGB(0, 0, 0));
DrawText(hdc, TEXT("Hello"), -1, &r, DT_CENTER);
EndPaint(hWnd, &ps);
break;

Am I doing something wrong in building the BSP? Or has anyone run into this same problem?

nicolas
Posts: 162
Joined: Sun Jun 07, 2009 4:32 pm

Re: CE problem: Cannot use DrawText() or SetWindowText()

Post by nicolas » Wed Sep 30, 2009 10:05 am

Store/Display the return values for the function calls that you are having problems with.
What are the return values?

itouch
Posts: 54
Joined: Mon Jul 27, 2009 5:20 am

Re: CE problem: Cannot use DrawText() or SetWindowText()

Post by itouch » Wed Sep 30, 2009 10:11 am

DrawText() returns 14, which is the height of the text. The function behaves as if it is working, but no output! I also tried ExtTextOut() with no success. It also returns with no errors. I am using the latest CE update, with the only change to use English as the language. This is driving me crazy.

nicolas
Posts: 162
Joined: Sun Jun 07, 2009 4:32 pm

Re: CE problem: Cannot use DrawText() or SetWindowText()

Post by nicolas » Wed Sep 30, 2009 10:26 am

CE update to PB or the latest CE image or the latest CE BSP.
Does it work with older images ?

Has it worked for you before ?

itouch
Posts: 54
Joined: Mon Jul 27, 2009 5:20 am

Re: CE problem: Cannot use DrawText() or SetWindowText()

Post by itouch » Wed Sep 30, 2009 10:39 am

I am using the latest CE BSP release (20090817). This is my first attempt at running CE on this board. I did expect some problems, but not this simple text drawing code! Everything else works, touch screen, serial ports, etc. Can someone verify that this works for them? A simple Hello app with one window and the WM_PAINT message as follows:

hdc = BeginPaint(hWnd, &ps);
GetClientRect(hWnd, &r);
DrawText(hdc, TEXT("Hello"), -1, &r, DT_CENTER);

Thanks in advance.

nicolas
Posts: 162
Joined: Sun Jun 07, 2009 4:32 pm

Re: CE problem: Cannot use DrawText() or SetWindowText()

Post by nicolas » Wed Sep 30, 2009 11:03 am

I would try some of the older CE images.
I have noticed some subtle differences to the newer CE Images and the BSP that have affected some of my code. I also noticed on the newer BSP and thus images, the MFC library has been removed, possibly others too.
Mind you if a library was missing, youd get a crash or error.

Check that your CE contains the files gx.dll and cegl.dll in windows folder. (read they were needed. They are the CE Draw Library)

Also try running it on the pc device emulator, that be the quickest way to tell if the issue is the CE image or the code.

itouch
Posts: 54
Joined: Mon Jul 27, 2009 5:20 am

Re: CE problem: Cannot use DrawText() or SetWindowText()

Post by itouch » Wed Sep 30, 2009 11:59 am

cegl.dll and gx.dll are 2 libraries used by CE Draw, ahigh-speed graphics library in Windows CE. I don't think that they are standard libraries.

itouch
Posts: 54
Joined: Mon Jul 27, 2009 5:20 am

Re: CE problem: Cannot use DrawText() or SetWindowText()

Post by itouch » Wed Sep 30, 2009 12:39 pm

I have resolved the problem. It was an operator error in the usage of DrawText().

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests