This site is no longer active and is available for archival purposes only. Registration and login is disabled.

DirectDraw and focus (phone calls) issues


DirectDraw and focus (phone calls) issues

Postby Kzinti » Jun 4, 2007 @ 6:25pm

I have added a DirectDraw driver to PocketHAL and am currently getting it tested. I am getting reports that losing focus doesn't work properly. I am using DDraw in exclusive "fullscreen" mode.

Anyone has experienced anything like this?

EDIT: I found a link that explains the problem in
more details:

http://forums.microsoft.com/MSDN/ShowPo ... 9&SiteID=1
Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby Kzinti » Jun 6, 2007 @ 4:41pm

So I investigated this so far. Basically the problem is this: once you have initialized DirectDraw, you don't ever receive WM_ACTIVATE or WM_SETFOCUS/WM_KILLFOCUS messages. In fact, I am not getting any message when my app should be losing focus.

Ludimate worked around this by listening for phone calls and low battery notifications. I guess it works for these 2 cases, but I am not happy with it. Someone somewhere must have run into this before?
Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby ~mono » Jun 7, 2007 @ 12:14pm

~mono
pm Member
 
Posts: 2
Joined: Jun 6, 2007 @ 1:22pm


Postby Cardinal » Jul 6, 2007 @ 11:50pm

Ya that one is something we've run into as well. I guess people don't really have to answer calls while playing our awesome games? :)
Cardinal
pm Member
 
Posts: 53
Joined: Feb 6, 2006 @ 5:39am
Location: Ottawa, Ontario


Postby Ludimate » Sep 21, 2007 @ 11:11am

An explanation and workaround for this problem:

http://forums.microsoft.com/MSDN/showpo ... 1&siteid=1

The MSDN article you cite is for Windows CE .NET 4.2. A similar article for WM5 states:

"The exclusive (full-screen) mode prevents other applications from allocating some surface types and from drawing to the primary display. The exclusive mode also prevents other windows on the system from coming to the foreground, so DirectDraw applications must watch for system events (such as incoming phone calls) so they can relinquish control back to the system when necessary."

http://msdn2.microsoft.com/en-us/library/ms847103.aspx

So, it seems to be a feature.


My solution is not to use DDSCL_FULLSCREEN cooperative level. Use DDSCL_NORMAL. Create your main window fullscreen, that is, with coordinates [0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)]. Use SHFullScreen() function to hide all interface elements. This way you have a fullscreen DirectDraw access but still can receive system messages, have working Home key etc.


I'm not sure if you are required to show everything back when your app is deactivated. I do it, just in case. Also the system may draw its UI above your window before telling you that you are deactivated. To prevent your app from overwriting parts of the UI you create an IDirectDrawClipper, set it to your primary surface, and attach you main window's HWND to it. This guarantees that you never overwrite parts of UI if they're above your window.
Ludimate
pm Member
 
Posts: 21
Joined: Jun 29, 2006 @ 8:40pm


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron