Windows Embedded CE and Windows Mobile (April 28, 2009)

Chat Topic: Windows Embedded CE and Windows Mobile
Date: Tuesday, April 28, 2009

Please note: portions of this chat have been edited for clarity.

Sue Loh [MS] (Moderator):
Hey folks, just so you know what's going on, the MSDN chat calendar is goofed up and doesn't list our chat. That's the way people normally join the chat, so we may not get many guests today.

kurtken [MS] (Expert):
Q:
I called PowerPolicyNotify with unattended set to true. I get notifications in my message queue that I've transitioned to unattended mode. If I write data to sockets during this time, my app stays alive. If I don't, my app dies. In the latter case, do I need to call SystemIdleTimerReset() to keep the device in unattended mode? That's a PocketPC question for WM6
A: When you say "my app dies", what do you mean? Do you mean it loses socket connection?

MikeCal [msft] (Expert):
Q:
I called PowerPolicyNotify with unattended set to true. I get notifications in my message queue that I've transitioned to unattended mode. If I write data to sockets during this time, my app stays alive. If I don't, my app dies. In the latter case, do I need to call SystemIdleTimerReset() to keep the device in unattended mode? That's a PocketPC question for WM6
A: Unattended mode still requires that you call SystemIdleTimerReset to keep the system from suspending. The main benefit of Unattended is that the device suspends immediately when you leave it if the screen is already off. Unattended doesn't keep the system from suspending due to user timeouts. It DOES keep the system from suspending if the user hits the Power button though.

MikeCal [msft] (Expert):
Q:
"my app dies" really just means execution stops. It resumes when I power on the device. I just noticed that if I'm not actively writing to a socket, execution stops about a minute later. Does writing to a socket internally call SystemIdleTimerReset()?
A: Regarding writing to a socket calling SITR(), I'm not aware of that. It's possible though, that certain OEMs have effectively done that for you in their drivers. You shouldn't rely on the behavior though. If you need to keep a PocketPC from suspending, the only guaranteed way to do it is to set unattended mode and then periodically call SystemIdleTimerReset. The first protects you against power button presses and the second protects you against inactive timeouts.

mikehall_ms (Moderator):
Q:
How to implement a font driver? Any guide?
A: What are you trying to achieve? - Windows CE has font engines for bitmap and scalable fonts (TrueType and Monotype).

Sue Loh [MS] (Moderator):
My question is here: https://www.microsoft.com/en-us/default.aspx
I want to implement a font driver, but I can't found enough documents to
start. I have a font file with private format which is stroke-based.
And I have a standard C library to render it.
I want to implement them as a font driver that GDI(or GWES) can use.
Microsoft has released an interface for third parties to supply their font
driver.
They call it "Pluggable fonts".
https://msdn.microsoft.com/en-us/library/bb665989.aspx
I have browsed some files in %WINCEROOT%\PUBLIC\COMMON\OAK\INC, like
winddi.h, winddif.h, fontdrv.h, truetypefontdriver.hpp...,
but I still don't know how to get the entry point.
Here are my questions:
1. My environment: VS2005 SP1 + Platform Builder 6.0 SP1(Evaluation)+ PB 6.0 R2. Is it sufficient? What else should I install?
2. In DrvEnableDriver(), the third parameter is in DRVENABLEDATA type, but there isn't any define of DrvTextOut in winddi.h. How to let DrvTextOut be used by GDI? Need I modify winddi.h? Also PENGCALLBACKS is in the same situation.
3. How to let the founction pointers defined in fontdrv.h, such as FDLOADFONTFILE(), FDQUERYFONT()..., being used? And how to use FD_INTERFACE?
4. Is a font driver in user-mode or kernel-mode? What's the difference?

mikehall_ms (Moderator):
Q:
Is there any sample codes for implementing a font driver?
A: Let me do some research on this and get back to you, send me an e-mail with the question to <addr removed>

mikehall_ms (Moderator):
Q:
Mikehall, if I have any further questions, should I post here, or write mail to you?
A: if its font engine related, ping me on e-mail

Justin Bouffard [MS] (Expert):
Q:
Mikehall, if I have any further questions, should I post here, or write mail to you?
A: I'd like to add: The benefit of asking here or like you did on communities is the exposure to more of either us (MSFT employees) and especially MVPs, who have a lot of hands-on experience with real-life platforms, so I wouldn't rule out that avenue in general

PaulT (Expert):
Q:
Is a font driver in the same position as a display driver? Is there any artitechure figure of the relationship of GDI, GPE, Display Driver, Printer Driver, font driver, DDI? If I want to implement a font driver, should I subclass from the GPE class?
A: I think that I can answer that one. No, the font driver is not the same, or even similar to a display driver. The font driver does one job: renders a given set of glyphs at a given location in a given device context. It appears to me that a simple DLL, not even a full-blown driver, is needed to do this. There's a list of functions that you've obviously seen on MSDN that you need to implement. The most-complex one seems to be DrvTextOut(), which does the actual drawing.

PaulT (Expert):
Q:
I see the DrvTextOut() is the most complex, and it defined in winddif.h. If I implement this function, how to add this DLL to the system which GDI will benifit this? And, is GDI will call this function depends on the registry?
A: Read the help on MSDN! There's a page about adding your font driver to the registry. It seemed clear to me on a quick read. There's also the AC3 and TTF drivers that Windows CE provides to compare to your settings...

PaulT (Expert):
Q:
I see the DrvTextOut() is the most complex, and it defined in winddif.h. If I implement this function, how to add this DLL to the system which GDI will benifit this? And, is GDI will call this function depends on the registry?
A: You have read this page? https://msdn.microsoft.com/en-us/library/bb665974.aspx

chienher_ms (Expert):
Q:
I see the DrvTextOut() is the most complex, and it defined in winddif.h. If I implement this function, how to add this DLL to the system which GDI will benifit this? And, is GDI will call this function depends on the registry?
A: CE GDI/Font Driver layer will not take your DrvTextout, the font driver interfaces are FntDrvQueryFont, FntDrvQueryFontFile, FntDrvQueryFontData, FntDrvDestroyFont, FntDrvLoadFontFile, FntDrvUnloadFontFil, FntDrvQueryTrueTypeTable. See fontdrv.h

PaulT (Expert):
Q:
Dear PAUL, I have saw the settings of registry, but I don't know the interface that GDI communicates with font driver, especially the function pointer as FDLOADFONTFILE()....
A: Read the page that I just posted. It lists what I presume, although it's not 100% clear, is the set of functions that you must implement in order to have a functional pluggable font driver. You're pretty obviously going to have to work out exactly what is needed by trial-and-error, but that's a reasonable place to start.

tomget_ms (Expert):
Q:
Dear PAUL, I have saw the settings of registry, but I don't know the interface that GDI communicates with font driver, especially the function pointer as FDLOADFONTFILE()....
A: Have you read the MSDN articles around https://msdn.microsoft.com/en-us/library/bb665978.aspx?

PaulT (Expert):
Q:
Dear PAUL, I've read the pages you post, but I still don't have a clear image of font driver and GDI, and their communication. expecially the FD_INTERFACE
A: I believe it. e-mail Mike, of course. I'll take a look at the source that I have and see if there's anything to contradict the MSDN documentation. On MSDN, find the Send Feedback links on the pluggable font driver pages and use those to tell the documentation team that you don't have enough information to do what you want. Start playing with things and see what happens...

BorMing_MS (Expert):
Q:
Must the timer ISR run as the highest priority in the system?
A: Not necessarily, but usually. If you have interrupts that requires immediate attention, you can configure the interrupt priority to be higher.

kevchin_MSFT (Expert):
Q:
Is there an API to pull out the current cellular radio version on WM?
A: Can you tell me if this works? https://msdn.microsoft.com/en-us/library/aa922509.aspx RIL_GetDriverVersion () -- not sure if this is what you mean.

chienher_ms (Expert):
Q:
We have a native mail rule that gets loaded by "tmail.exe" on many devices. On uninstall, the mail rule dll is sometimes held by tmail.exe and uninstall requires a restart. Is there a safeway to close tmail from the CE Setup DLL?
A: Have you try to close the main window of Tmail and wait for it get destroied, "Inbox.MainWnd"? Search "Inbox.MainWnd" under MSDN and you will find few exampels discussed about how to close TMail.

Sue Loh [MS] (Moderator):
Hello everyone, we are just about out of time.

Thank you for joining us for our Windows Embedded CE 6.0 and Windows Mobile chat today!

Sue Loh [MS] (Moderator):
Sorry for the MSDN page mix-up.

Sue Loh [MS] (Moderator):
The transcript of today's chat will be posted online as soon as possible, to https://msdn.microsoft.com/en-us/chats/bb250671.aspx. We'll see you again for another chat next month. Please check https://msdn.microsoft.com/chats for the list of upcoming chats.

Sue Loh [MS] (Moderator):
If you still have unanswered questions, let me suggest that you post them on one of our newsgroups, such as Microsoft.public.windowsce.platbuilder.