Programming Microsoft Windows Ce Net 3Rd [Electronic resources]

نسخه متنی -صفحه : 169/ 119
نمايش فراداده

GAPI Maintenance

You can suspend the GAPI application in place to allow other applications access to the screen and keyboard. The two functions that suspend and resume the GAPI functions are appropriately named

int GXSuspend();

and

int GXResume();

When the GAPI application calls GXSuspend, the GAPI library temporarily releases its control over the buttons in the system, allowing other applications to operate normally. The desktop is also redrawn. When GXResume is called, the buttons are redirected back to the GAPI application. The GAPI application is responsible for restoring the screen to the state it was in before GXSuspend was called. It's the responsibility of the GAPI application to stop accessing the frame buffer when another application gains the focus.

The suggested place for these two functions is in the WM_SETFOCUS and WM_KILLFOCUS message handlers of your main window. This way, if another application rudely interrupts your game by setting itself into the foreground, your application will handle it gracefully.