On Windows Mobile device, what is the best way to display an OK button instead of the X button?
-
09-06-2019 - |
Question
I have a C++ program that when run, by default, displays the X in the upper right corner. Clicking X, minimizes the program. I've added code using the SHInitDialog function to change the X to OK, so that clicking OK exits the program.
My question: Is there a better method that applies to the window, since SHInitDialog works best with Dialog Boxes?
Solution 2
With Windows Mobile 5.0 and higher, using the CreateWindowEx function passing it WS_EX_CAPTIONOKBTN for the extended style works.
@ctacke SHDoneButton may have also worked but I wanted to change the main window without handling it like a dialogbox, which is basically what SHInitDialog is doing.
OTHER TIPS
Take a look at SHDoneButton API.
Not sure how it's done in C++, but in .NET if you set the MinimizeBox property to false, you get an OK button. Since .NET Windows code is fancy wrapper code, there should be a C++ equivalent