I have a C# application that's main purpose is to serve as an application menu to launch third party software. The main window covers the entire screen, but is not "maximized" or "always on top".
The hardware platform is a custom designed tablet PC, with a Pentium M processor and Windows XP Pro, Tablet edition.
The issue I'm having is enabling the user to shutdown the computer. In order to perform a shutdown we want the user to press our power button on the front bezel. This should cause the normal windows response, which we have set to "Ask me what to do".
When my main windows is being displayed, this works - but only once... The first press of the button displays the dialog with the typical "standby", "shutdown", "restart" choices. At that point, if I select "cancel", the window goes away and never comes back. I believe it's being hidden by my application after the first time based on the fact that if I press Alt-Tab I can see another, unnamed window in the list. Of course, I can't switch focus, because the keystroke automatically hides that dialog box.
Some other points of information: If I run another application (such as IE), pressing the power button always displays the dialog. Only when my app has the focus do I run into the "first-time only" problem. In addition, I have an on-screen keyboard that I developed which is "always on top". If the power button is pressed while the OSK is displayed, my main window appears to come to the foreground and hide the OSK somehow (but still show the shutdown dialog the first time).
Note - there is no handling of this power button in my application - it is connected using the ATX power button pin, so windows should be taking care of it. It appears to be a strange window interaction behavior.
One possibility would be to design your own shutdown dialog tha you can have control over. I could help you with that design, if you think that is a possibility.
Thanks, but I would rather not consider that option at this point. That fact that it works the first time leads me to believe it can be fixed to work all the time.
That's the thing - my main window is not always on top, just the OSK. I don't know why my main window would be hiding the dialog. Even when the OSK is hidden, the main window is causing the issue...
OK, I could swear that when I first looked at the issue that the window was being shown, just that it appeared to be behind my application window. Now it looks like it's not being displayed at all. When I hit Alt->Tab there is no dialog present in the list.
I have a further related/unrelated question, LearnedOne...
I'll be the first to admit that I'm new to windows programming. I've spent my past 10+ years in the embedded world. When I started out developing this application, it seemed that C# was the latest language on the scene and it, along with .NET, provided many tools and reusable components to expidite application development. At this point I'm concerned with the reliability of the framework. Is .NET being used widely in the industry with successful results? Are the issues I'm seeing common with windows programming in general, or would using VC++ to redo my application be advantageous?
I'm not trying to start any arguments, but I'm under the gun and am trying to pick the best course of action to remove as many bugs as possible from my applications...
C# is very good at some things, but may lack a little control that VC++ would have. The thing that you have to know about VC++ is that you have to handle a lot more, and the syntax rules are very different from C#. If you came from a Win32 or MFC background, I would say that VC++.NET would be a smooth transition, but if you didn't I would tend to stay away from this.
.NET is used extensively, and successfully in many places, but that depends on how it is being used, and doesn't guarantee 100% success without a little work.
Windows programming can be pretty tricky, so if you want some help to get you out from under the gun, then you can give me a better understand as to what you are trying to do, and maybe I can come up with a better game plan.
I appreciate the input. At this point, I'm considering starting from a clean slate and building up the application again. It will still be in C#/.NET, but I can incorporate some lessons learned over the past 6 months and hopefully yield a better product in the end. At the least try to see if there is somewhere along the way that these nuisances get introduced to understand them better.
Back to the original question. Did you have any more input/suggestions based on the fact that the dialog box is not being shown at all?