Windows – Nonclosing close button in Windows Mobile ( developed with Qt)

qtwindows-mobile

Whenever I set maximized the Windows Mobile applications by code that I developed with Qt , their titlebar disappear and there remains only Windows Mobile's default Title Bar. However, whenever I click on that X button, Application won't get closed; instead it keeps running behind.

alt text http://img27.imageshack.us/img27/2296/winmobileexit.jpg

After a few Google searches, I realized that this is the default behaviour for X button on Windows Mobile, which is also the cause of my problem; when I want to show the minimized/hided program by clicking Activate from Settings->System->Memory->Running Programs,

alt text http://img17.imageshack.us/img17/7387/winmobileexit2.jpg

Application isn't repainted and remains invisible and child widgets respond the respective events:

alt text http://img505.imageshack.us/img505/5276/winmobileexit3.jpg

I don't think this behaviour is any way related to my code, as this problem occurs even with the following simple code: ( I would be appreciated if you can test this on your device)

#include <QApplication>
#include <QtGui>


int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QLabel w("aduket");
    w.setWindowState(w.windowState()|Qt::WindowMaximized);
    w.show();
    return a.exec();
}

Although, I have tried to get the close event of that button, I couldn't. Yet again, only solution that cconceived to me is to remove that X button and add an Exit item to the bottom right menu. Is this reasonable? What might be the cause of this behaviour? Do you have any idea how to resolve this behavior?

Thanks in advance.

Best Answer

The "Smart Minimize" button is handled by a style bit typically set when the Windows is created - specifically WS_NONAVDONEBUTTON. For a CF application, this is controlled by setting the MinimizeButton property to false. In C/C++, it is done by adding the bit when calling CreateWindow or setting the bit afterward (directly or, as Shane suggests, via SHDoneButton).

Qt is obviously creating a Window, so it's in that process that you need to change the style bit. I'm not a Qt developer, so exactly how it's done in that framework I don't know.