Application Focus

Discuss PocketC for CE (including Desktop Edition)

Postby chrisleeuk on Tue Nov 05, 2002 12:50 pm

Does anyone know of an easy way to capture an event when an application gains or looses focus?

I am using the eventmsg command to details windows events and messages.
Formulation, Visual Environment for Pocket C - (in development)
Posts: 31
Joined: Fri May 10, 2002 7:40 am

Postby guy on Tue Nov 05, 2002 9:09 pm

I don't think you can do it with eventmsg(), or with the current version of CEAPI.

The new version of CEAPI has a method of capturing windows messages that are sent directly to a window rather than being queued. To use it you would have to use the full windows messaging CEAPI setup, declare that you want to watch WM_ACTIVATE (I think) messages to the main window, then handle them in your message loop.

You can only watch messages to windows that are created with the CEAPI CreateWindow() and CreateWindowEx() functions, which means that you need to define the CEAPI_WIN32 macro before including any of the header files, then create your own application class and main window. You can then call CEAPISetRepost() for WM_ACTIVATE on the main window.

I'll try to remember to update the header files so that they actually contain WM_ACTIVATE when I release the CEAPI update.

I don't think that you can do it with normal PocketC. You might try looking for PM_PAINT messages going to GUIID 1.

PocketC CE API interface:
PCForm and CE API forum:
PocketC CE API interface:
PCForm and CE API forum:
Posts: 879
Joined: Thu Dec 07, 2000 8:58 am
Location: United Kingdom

Return to PocketC for CE

Who is online

Users browsing this forum: No registered users and 1 guest