Hi there,

I am a newbie of WinCE. I have an application which is CFrameWnd based
application. In most cases of PDA, people click the close icon [X] of the
form will only cause the AP to be hidden. However, I have a special PDA
called O2(WM5) which will close my AP whenever the close icon [X] was
clicked. Is there a way to prevent a frame base window to be close on WinCE
?

I tried dialog based AP. In the case of dialog based application , I
overrided the OnOK method, which can stop the CLOSE procedure successfully.
However, In the case of CFrameWnd based application, even though I
overrided the mehtod of CDocument::CanCloseFrame, the application still be
closed. WHY?



Let me wrote simply, hope you can find the place where is not correct.

In the case of CDialog
MyDialog:OnOk() // default close function of a modal dialog
{
// CDialog::OnOk(); <-- mark this line can stop window close procedure
}

In the case of CFrameWnd
MyFrame:OnClose() // close frame window
{
// CFrameWnd::OnClose(); <-- mark this didnt stop the close procedure
}

Is Anything wrong ?
any help is appreciated


Avex

Re: How to avoid a frame based window to be closed in WinCE? by Chris

Chris
Mon Nov 27 14:11:35 CST 2006

"Avex" <I.dont@like.Spammer> wrote in message
news:ek2utv$571$1@netnews.hinet.net...
> Hi there,
> I tried dialog based AP. In the case of dialog based application , I
> overrided the OnOK method, which can stop the CLOSE procedure
> successfully.
> However, In the case of CFrameWnd based application, even though I
> overrided the mehtod of CDocument::CanCloseFrame, the application still
> be
> closed. WHY?

As I recall, you're in the right place - you need to override the Frame
OnClose command and then not call the base class. The only other thing I
can think of is do you also need to return something? Sorry for the
vagueness, but it's been a while since I did any MFC.

You should at least be able to set breakpoints and see what's getting called
when.