![]() |
|
Using SHFullScreen for writing full screen applications
By Vassili Philippov, June 29, 2001.
IntroductionOne of the most frequently asked questions in Pocket PC developer news groups is how to create full screen application. Although answer is simple "use SHFullScreen function" it isn't real answer because there are several aspects that developer should keep in mind when work with SHFullScreen function. BackgroundThere are several elements that usually are on the screen. These elements are task bar, start icon and SIP button (Software Input Panel button). SHFullScreen function can hide and show each of them. But this function doesn't work with command bar. SHFullScreen function doesn't really hide elements but change their z-order and they become one level below the topmost window that is why your window should be the topmost to create it full screen. Full screen notesNote 1. Main windowSHFullScreen function doesn't work with child windows. For example in view based application you should not pass view window as the first parameter because it's a child window of main frame window. Note 2. Foreground windowSHFullScreen function can work only with foreground windows. It's because SHFullScreen function doesn't hide elements like task bar but change their z-order so that they become just under the foreground window. So if your window isn't foreground task bar, start icon and SIP button will be still above your window and will be visible. Note 3. Command barSHFullScreen function doesn't hide command bar that exists in most windows. To hide command bar you should use SetVisible function. Your code that does it could be the following: dialog: view: Note 4. ResizeAfter calling SHFullScreen function that hides necessary elements you should resize your window to fill additional space. There are several ways to find size of the whole screen (usually 240x320) for example you could use GetDeviceCaps function. Note 5. InitializationSHFullScreen function cannot be used until the window is shown. So you cannot use SHFullScreen function in OnInitDialog method of dialog to create full a screen dialog or in OnCreate method of view to create a full screen view. The way I suggest is to post a message during initialization and call SHFullScreen function in the handler of this message. It will allow calling SHFullScreen function the first thing after initialization. Note 6. ActivationAfter change of z-order task bar, start icon and SIP button become the topmost. So we should recall SHFullScreen function each time the window is activated (in WM_ACTIVATE handler). Note 7. SIPBefore calling SHFullScreen function we should hide software input panel if it's visible. ... ConclusionMost challenges of working with SHFullScreen appear because this function doesn't hide task bar, start icon and command bar but change their z-order to be just under the topmost window and these elements restores their z-order after every change in windows z-order. You could also use ST library that do all this work for you and make programming of full screen applications easy. Related resources:
DiscussDiscuss this article. Here you can write your comments and read comments of other developers. |
|||||||||||||||||||||