1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: msw/toplevel.cpp
3 // Purpose: implements wxTopLevelWindow for MSW
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
9 // License: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "toplevel.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
33 #include "wx/toplevel.h"
34 #include "wx/string.h"
38 #include "wx/control.h"
39 #include "wx/containr.h" // wxSetFocusToChild()
42 #include "wx/os2/private.h"
44 // ----------------------------------------------------------------------------
45 // stubs for missing functions under MicroWindows
46 // ----------------------------------------------------------------------------
49 // ----------------------------------------------------------------------------
51 // ----------------------------------------------------------------------------
53 // list of all frames and modeless dialogs
54 wxWindowList wxModelessWindows
;
56 // the name of the default wxWindows class
57 extern void wxAssociateWinWithHandle( HWND hWnd
60 bool wxTopLevelWindowOS2::m_sbInitialized
= FALSE
;
61 wxWindow
* wxTopLevelWindowOS2::m_spHiddenParent
= NULL
;
63 // ============================================================================
64 // wxTopLevelWindowOS2 implementation
65 // ============================================================================
67 BEGIN_EVENT_TABLE(wxTopLevelWindowOS2
, wxTopLevelWindowBase
)
68 EVT_ACTIVATE(wxTopLevelWindowOS2::OnActivate
)
71 // ============================================================================
72 // wxTopLevelWindowMSW implementation
73 // ============================================================================
76 MRESULT EXPENTRY
wxDlgProc( HWND
WXUNUSED(hWnd
)
78 ,MPARAM
WXUNUSED(wParam
)
79 ,MPARAM
WXUNUSED(lParam
)
86 // For this message, returning TRUE tells system to set focus to
87 // the first control in the dialog box, but we set the focus
88 // ourselves, however in OS/2 we must return true to enable the dialog
93 // For all the other ones, FALSE means that we didn't process the
96 return (MRESULT
)FALSE
;
100 // ----------------------------------------------------------------------------
101 // wxTopLevelWindowOS2 creation
102 // ----------------------------------------------------------------------------
104 void wxTopLevelWindowOS2::Init()
106 m_bIconized
= m_bMaximizeOnShow
= FALSE
;
109 // Unlike (almost?) all other windows, frames are created hidden
114 // Data to save/restore when calling ShowFullScreen
116 m_lFsOldWindowStyle
= 0;
117 m_bFsIsMaximized
= FALSE
;
118 m_bFsIsShowing
= FALSE
;
120 m_hFrame
= NULLHANDLE
;
121 memset(&m_vSwp
, 0, sizeof(SWP
));
122 memset(&m_vSwpClient
, 0, sizeof(SWP
));
123 m_pWinLastFocused
= (wxWindow
*)NULL
;
124 } // end of wxTopLevelWindowIOS2::Init
126 void wxTopLevelWindowOS2::OnActivate(
127 wxActivateEvent
& rEvent
130 if (rEvent
.GetActive())
133 // Restore focus to the child which was last focused
135 wxLogTrace(_T("focus"), _T("wxTLW %08x activated."), m_hWnd
);
137 wxWindow
* pParent
= m_pWinLastFocused
? m_pWinLastFocused
->GetParent()
144 wxSetFocusToChild( pParent
151 // Remember the last focused child if it is our child
153 m_pWinLastFocused
= FindFocus();
156 // So we NULL it out if it's a child from some other frame
158 wxWindow
* pWin
= m_pWinLastFocused
;
162 if (pWin
->IsTopLevel())
166 m_pWinLastFocused
= NULL
;
170 pWin
= pWin
->GetParent();
173 wxLogTrace(_T("focus"),
174 _T("wxTLW %08x deactivated, last focused: %08x."),
176 m_pWinLastFocused
? GetHwndOf(m_pWinLastFocused
)
180 } // end of wxTopLevelWindowOS2::OnActivate
182 WXDWORD
wxTopLevelWindowOS2::OS2GetStyle(
184 , WXDWORD
* pdwExflags
187 long lMsflags
= wxWindow::OS2GetStyle( (lStyle
& ~wxBORDER_MASK
) | wxBORDER_NONE
191 if (lStyle
== wxDEFAULT_FRAME_STYLE
)
192 lMsflags
|= FCF_SIZEBORDER
| FCF_TITLEBAR
| FCF_SYSMENU
|
193 FCF_MINMAX
| FCF_TASKLIST
;
196 if ((lStyle
& wxCAPTION
) == wxCAPTION
)
197 lMsflags
|= FCF_TASKLIST
;
199 lMsflags
|= FCF_NOMOVEWITHOWNER
;
201 if ((lStyle
& wxVSCROLL
) == wxVSCROLL
)
202 lMsflags
|= FCF_VERTSCROLL
;
203 if ((lStyle
& wxHSCROLL
) == wxHSCROLL
)
204 lMsflags
|= FCF_HORZSCROLL
;
205 if (lStyle
& wxMINIMIZE_BOX
)
206 lMsflags
|= FCF_MINBUTTON
;
207 if (lStyle
& wxMAXIMIZE_BOX
)
208 lMsflags
|= FCF_MAXBUTTON
;
209 if (lStyle
& wxTHICK_FRAME
)
210 lMsflags
|= FCF_DLGBORDER
;
211 if (lStyle
& wxSYSTEM_MENU
)
212 lMsflags
|= FCF_SYSMENU
;
213 if (lStyle
& wxCAPTION
)
214 lMsflags
|= FCF_TASKLIST
;
215 if (lStyle
& wxCLIP_CHILDREN
)
217 // Invalid for frame windows under PM
220 if (lStyle
& wxTINY_CAPTION_VERT
)
221 lMsflags
|= FCF_TASKLIST
;
222 if (lStyle
& wxTINY_CAPTION_HORIZ
)
223 lMsflags
|= FCF_TASKLIST
;
225 if ((lStyle
& wxTHICK_FRAME
) == 0)
226 lMsflags
|= FCF_BORDER
;
227 if (lStyle
& wxFRAME_TOOL_WINDOW
)
228 *pdwExflags
= kFrameToolWindow
;
230 if (lStyle
& wxSTAY_ON_TOP
)
231 lMsflags
|= FCF_SYSMODAL
;
234 } // end of wxTopLevelWindowOS2::OS2GetCreateWindowFlags
236 WXHWND
wxTopLevelWindowOS2::OS2GetParent() const
239 // For the frames without wxFRAME_FLOAT_ON_PARENT style we should use NULL
240 // parent HWND or it would be always on top of its parent which is not what
241 // we usually want (in fact, we only want it for frames with the
242 // wxFRAME_FLOAT_ON_PARENT flag)
246 if (HasFlag(wxFRAME_FLOAT_ON_PARENT
) )
248 pParent
= GetParent();
250 // this flag doesn't make sense then and will be ignored
251 wxASSERT_MSG( pParent
,
252 _T("wxFRAME_FLOAT_ON_PARENT but no parent?") );
254 else // don't float on parent, must not be owned
258 if (HasFlag(wxFRAME_NO_TASKBAR
) && !pParent
)
260 if (!m_spHiddenParent
)
262 m_spHiddenParent
= new wxTopLevelWindowOS2(NULL
, -1, _T(""));
265 // We shouldn't leave it in wxTopLevelWindows or we wouldn't
266 // terminate the app when the last user-created frame is deleted --
267 // see ~wxTopLevelWindowMSW
269 wxTopLevelWindows
.DeleteObject(m_spHiddenParent
);
271 pParent
= m_spHiddenParent
;
273 return pParent
? pParent
->GetHWND() : NULL
;
274 } // end of wxTopLevelWindowOS2::OS2GetParent
276 bool wxTopLevelWindowOS2::CreateDialog(
278 , const wxString
& rsTitle
279 , const wxPoint
& rPos
280 , const wxSize
& rSize
283 wxWindow
* pParent
= GetParent();
286 // For the dialogs without wxDIALOG_NO_PARENT style, use the top level
287 // app window as parent - this avoids creating modal dialogs without
290 if (!pParent
&& !(GetWindowStyleFlag() & wxDIALOG_NO_PARENT
))
292 pParent
= wxTheApp
->GetTopWindow();
297 // Don't use transient windows as parents, this is dangerous as it
298 // can lead to a crash if the parent is destroyed before the child
300 // also don't use the window which is currently hidden as then the
301 // dialog would be hidden as well
302 if ((pParent
->GetExtraStyle() & wxWS_EX_TRANSIENT
) ||
314 hWndOwner
= GetHwndOf(pParent
);
316 hWndOwner
= HWND_DESKTOP
;
318 hWndDlg
= ::WinLoadDlg( HWND_DESKTOP
322 ,(ULONG
)ulDlgTemplate
326 m_hWnd
= (WXHWND
) hWndDlg
;
330 wxFAIL_MSG(_("Did you forget to include wx/os2/wx.rc in your resources?"));
332 wxLogSysError(_("Can't create dialog using template '%ul'"), ulDlgTemplate
);
338 // Move the dialog to its initial position without forcing repainting
345 if (!OS2GetCreateWindowCoords( rPos
353 nX
= nWidth
= (int)CW_USEDEFAULT
;
357 // We can't use CW_USEDEFAULT here as we're not calling CreateWindow()
358 // and passing CW_USEDEFAULT to MoveWindow() results in resizing the
359 // window to (0, 0) size which breaks quite a lot of things, e.g. the
360 // sizer calculation in wxSizer::Fit()
362 if (nWidth
== (int)CW_USEDEFAULT
)
365 // The exact number doesn't matter, the dialog will be resized
366 // again soon anyhow but it should be big enough to allow
367 // calculation relying on "totalSize - clientSize > 0" work, i.e.
368 // at least greater than the title bar height
370 nWidth
= nHeight
= 100;
372 if (nX
== (int)CW_USEDEFAULT
)
375 // Centre it on the screen - what else can we do?
377 wxSize vSizeDpy
= wxGetDisplaySize();
379 nX
= (vSizeDpy
.x
- nWidth
) / 2;
380 nY
= (vSizeDpy
.y
- nHeight
) / 2;
382 m_backgroundColour
.Set(wxString("LIGHT GREY"));
384 LONG lColor
= (LONG
)m_backgroundColour
.GetPixel();
386 if (!::WinSetPresParam( m_hWnd
395 ::WinSetWindowPos( GetHwnd()
401 ,SWP_MOVE
| SWP_SIZE
| SWP_ZORDER
| SWP_SHOW
| SWP_ACTIVATE
403 ::WinQueryWindowPos(GetHwnd(), GetSwp());
407 } // end of wxTopLevelWindowOS2::CreateDialog
409 bool wxTopLevelWindowOS2::CreateFrame(
410 const wxString
& rsTitle
411 , const wxPoint
& rPos
412 , const wxSize
& rSize
416 WXDWORD lFlags
= OS2GetCreateWindowFlags(&lExflags
);
417 long lStyle
= GetWindowStyleFlag();
420 int nWidth
= rSize
.x
;
421 int nHeight
= rSize
.y
;
422 ULONG ulStyleFlags
= 0L;
425 wxWindow
* pParent
= GetParent();
431 hParent
= GetHwndOf(pParent
);
433 hParent
= HWND_DESKTOP
;
435 if ((lStyle
& wxMINIMIZE
) || (lStyle
& wxICONIZE
))
436 ulStyleFlags
|= WS_MINIMIZED
;
437 if (lStyle
& wxMAXIMIZE
)
438 ulStyleFlags
|= WS_MAXIMIZED
;
441 // Clear the visible flag, we always call show
443 ulStyleFlags
&= (unsigned long)~WS_VISIBLE
;
447 // Create the frame window: We break ranks with other ports now
448 // and instead of calling down into the base wxWindow class' OS2Create
449 // we do all our own stuff here. We will set the needed pieces
450 // of wxWindow manually, here.
453 hFrame
= ::WinCreateStdWindow( hParent
454 ,ulStyleFlags
// frame-window style
455 ,(PULONG
)&lFlags
// window style
456 ,(PSZ
)wxFrameClassName
// class name
457 ,(PSZ
)rsTitle
.c_str() // window title
458 ,0L // default client style
459 ,NULLHANDLE
// resource in executable file
461 ,&hClient
// receives client window handle
465 vError
= ::WinGetLastError(vHabmain
);
466 sError
= wxPMErrorToStr(vError
);
467 wxLogError("Error creating frame. Error: %s\n", sError
);
472 // wxWindow class' m_hWnd set here and needed associations
476 wxAssociateWinWithHandle(m_hWnd
, this);
477 wxAssociateWinWithHandle(m_hFrame
, this);
479 m_backgroundColour
.Set(wxString("MEDIUM GREY"));
481 LONG lColor
= (LONG
)m_backgroundColour
.GetPixel();
483 if (!::WinSetPresParam( m_hWnd
489 vError
= ::WinGetLastError(vHabmain
);
490 sError
= wxPMErrorToStr(vError
);
491 wxLogError("Error creating frame. Error: %s\n", sError
);
496 // Now need to subclass window. Instead of calling the SubClassWin in wxWindow
497 // we manually subclass here because we don't want to use the main wxWndProc
500 m_fnOldWndProc
= (WXFARPROC
) ::WinSubclassWindow(m_hFrame
, (PFNWP
)wxFrameMainWndProc
);
503 // Now size everything. If adding a menu the client will need to be resized.
508 nY
= pParent
->GetSize().y
- (nY
+ nHeight
);
514 ::WinQueryWindowRect(HWND_DESKTOP
, &vRect
);
515 nY
= vRect
.yTop
- (nY
+ nHeight
);
517 if (!::WinSetWindowPos( m_hFrame
523 ,SWP_SIZE
| SWP_MOVE
| SWP_ACTIVATE
| SWP_ZORDER
526 vError
= ::WinGetLastError(vHabmain
);
527 sError
= wxPMErrorToStr(vError
);
528 wxLogError("Error sizing frame. Error: %s\n", sError
);
531 lStyle
= ::WinQueryWindowULong( m_hWnd
534 lStyle
|= WS_CLIPCHILDREN
;
535 ::WinSetWindowULong( m_hWnd
540 } // end of wxTopLevelWindowOS2::CreateFrame
542 bool wxTopLevelWindowOS2::Create(
545 , const wxString
& rsTitle
546 , const wxPoint
& rPos
547 , const wxSize
& rSize
549 , const wxString
& rsName
556 m_windowStyle
= lStyle
;
558 m_windowId
= vId
== -1 ? NewControlId() : vId
;
559 wxTopLevelWindows
.Append(this);
561 pParent
->AddChild(this);
563 if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG
)
566 // We have different dialog templates to allows creation of dialogs
567 // with & without captions under OS2indows, resizeable or not (but a
568 // resizeable dialog always has caption - otherwise it would look too
573 if (lStyle
& wxRESIZE_BORDER
)
574 ulDlgTemplate
= (ULONG
)kResizeableDialog
;
575 else if (lStyle
& wxCAPTION
)
576 ulDlgTemplate
= (ULONG
)kCaptionDialog
;
578 ulDlgTemplate
= (ULONG
)kNoCaptionDialog
;
579 return CreateDialog( ulDlgTemplate
587 return CreateFrame( rsTitle
592 } // end of wxTopLevelWindowOS2::Create
594 wxTopLevelWindowOS2::~wxTopLevelWindowOS2()
596 if (this == m_spHiddenParent
)
599 // Stop [infinite] recursion which would otherwise happen when we do
600 // "delete ms_hiddenParent" below -- and we're not interested in doing
601 // anything of the rest below for that window because the rest of
602 // wxWindows doesn't even know about it
607 if (wxModelessWindows
.Find(this))
608 wxModelessWindows
.DeleteObject(this);
611 // After destroying an owned window, Windows activates the next top level
612 // window in Z order but it may be different from our owner (to reproduce
613 // this simply Alt-TAB to another application and back before closing the
614 // owned frame) whereas we always want to yield activation to our parent
616 if (HasFlag(wxFRAME_FLOAT_ON_PARENT
))
618 wxWindow
* pParent
= GetParent();
622 ::WinSetWindowPos( GetHwndOf(pParent
)
631 // If this is the last top-level window, we're going to exit and we should
632 // delete ms_hiddenParent now to avoid leaking it
634 if (IsLastBeforeExit())
636 if (m_spHiddenParent
)
638 delete m_spHiddenParent
;
639 m_spHiddenParent
= NULL
;
642 } // end of wxTopLevelWindowOS2::~wxTopLevelWindowOS2
644 // ----------------------------------------------------------------------------
645 // wxTopLevelWindowOS2 client size
646 // ----------------------------------------------------------------------------
648 void wxTopLevelWindowOS2::DoSetClientSize(
654 // Call GetClientAreaOrigin() to take the toolbar into account
656 wxPoint vPt
= GetClientAreaOrigin();
661 wxWindow::DoSetClientSize( nWidth
664 } // end of wxTopLevelWindowOS2::DoSetClientSize
666 void wxTopLevelWindowOS2::DoGetClientSize(
671 wxWindow::DoGetClientSize( pnX
675 wxPoint vPt
= GetClientAreaOrigin();
682 } // end of wxTopLevelWindowOS2::DoGetClientSize
684 // ----------------------------------------------------------------------------
685 // wxTopLevelWindowOS2 showing
686 // ----------------------------------------------------------------------------
688 void wxTopLevelWindowOS2::DoShowWindow(
692 ::WinShowWindow(m_hFrame
, (BOOL
)(nShowCmd
& SWP_SHOW
));
695 // Need to artificially send a size event as wxApps often expect to do some
696 // final child control sizing
698 m_bIconized
= nShowCmd
== SWP_MINIMIZE
;
699 } // end of wxTopLevelWindowOS2::DoShowWindow
701 bool wxTopLevelWindowOS2::Show(
711 if (m_bMaximizeOnShow
)
713 nShowCmd
= SWP_MAXIMIZE
;
714 m_bMaximizeOnShow
= FALSE
;
725 DoShowWindow(nShowCmd
);
729 wxActivateEvent
vEvent(wxEVT_ACTIVATE
, TRUE
, m_windowId
);
731 ::WinQueryWindowPos(m_hFrame
, &vSwp
);
732 m_bIconized
= vSwp
.fl
& SWP_MINIMIZE
;
733 ::WinQueryWindowPos(m_hWnd
, &m_vSwpClient
);
734 ::WinSendMsg(m_hFrame
, WM_UPDATEFRAME
, (MPARAM
)~0, 0);
735 ::WinQueryWindowPos(m_hWnd
, &vSwp
);
736 ::WinEnableWindow(m_hFrame
, TRUE
);
739 // Deal with children
741 MoveChildren(m_vSwpClient
.cy
- vSwp
.cy
);
742 vEvent
.SetEventObject(this);
743 GetEventHandler()->ProcessEvent(vEvent
);
748 // Try to highlight the correct window (the parent)
752 HWND hWndParent
= GetHwndOf(GetParent());
754 ::WinQueryWindowPos(hWndParent
, &vSwp
);
755 m_bIconized
= vSwp
.fl
& SWP_MINIMIZE
;
756 ::WinEnableWindow(hWndParent
, TRUE
);
760 } // end of wxTopLevelWindowOS2::Show
762 // ----------------------------------------------------------------------------
763 // wxTopLevelWindowOS2 maximize/minimize
764 // ----------------------------------------------------------------------------
766 void wxTopLevelWindowOS2::Maximize(
773 // Just maximize it directly
775 DoShowWindow(bMaximize
? SWP_MAXIMIZE
: SWP_RESTORE
);
780 // We can't maximize the hidden frame because it shows it as well, so
781 // just remember that we should do it later in this case
783 m_bMaximizeOnShow
= TRUE
;
785 } // end of wxTopLevelWindowOS2::Maximize
787 bool wxTopLevelWindowOS2::IsMaximized() const
791 ::WinQueryWindowPos(m_hFrame
, (PSWP
)&m_vSwp
);
792 return (m_vSwp
.fl
& SWP_MAXIMIZE
);
793 } // end of wxTopLevelWindowOS2::IsMaximized
795 void wxTopLevelWindowOS2::Iconize(
799 DoShowWindow(bIconize
? SWP_MINIMIZE
: SWP_RESTORE
);
800 } // end of wxTopLevelWindowOS2::Iconize
802 bool wxTopLevelWindowOS2::IsIconized() const
804 // also update the current state
805 ::WinQueryWindowPos(m_hFrame
, (PSWP
)&m_vSwp
);
806 if (m_vSwp
.fl
& SWP_MINIMIZE
)
807 ((wxTopLevelWindow
*)this)->m_bIconized
= TRUE
;
809 ((wxTopLevelWindow
*)this)->m_bIconized
= FALSE
;
811 } // end of wxTopLevelWindowOS2::IsIconized
813 void wxTopLevelWindowOS2::Restore()
815 DoShowWindow(SWP_RESTORE
);
816 } // end of wxTopLevelWindowOS2::Restore
818 // generate an artificial resize event
819 void wxTopLevelWindowOS2::SendSizeEvent()
823 RECTL vRect
= wxGetWindowRect(GetHwnd());
825 (void)::WinPostMsg( m_hFrame
827 ,MPFROM2SHORT(vRect
.xRight
- vRect
.xLeft
, vRect
.yTop
- vRect
.yBottom
)
828 ,MPFROM2SHORT(vRect
.xRight
- vRect
.xLeft
, vRect
.yTop
- vRect
.yBottom
)
831 } // end of wxTopLevelWindowOS2::SendSizeEvent
833 // ----------------------------------------------------------------------------
834 // wxTopLevelWindowOS2 fullscreen
835 // ----------------------------------------------------------------------------
837 bool wxTopLevelWindowOS2::ShowFullScreen(
847 m_bFsIsShowing
= TRUE
;
851 // Zap the frame borders
855 // Save the 'normal' window lStyle
857 m_lFsOldWindowStyle
= ::WinQueryWindowULong( (HWND
)GetHWND()
862 // Save the old position, width & height, maximize state
864 m_vFsOldSize
= GetRect();
865 m_bFsIsMaximized
= IsMaximized();
868 // Decide which window lStyle flags to turn off
870 LONG lNewStyle
= m_lFsOldWindowStyle
;
873 if (lStyle
& wxFULLSCREEN_NOBORDER
)
874 lOffFlags
|= FCF_BORDER
;
875 if (lStyle
& wxFULLSCREEN_NOCAPTION
)
876 lOffFlags
|= (FCF_TASKLIST
| FCF_SYSMENU
);
878 lNewStyle
&= (~lOffFlags
);
881 // Change our window style to be compatible with full-screen mode
883 ::WinSetWindowULong( (HWND
)GetHWND()
889 // Resize to the size of the desktop
893 RECTL vRect
= wxGetWindowRect(HWND_DESKTOP
);
895 nWidth
= vRect
.xRight
- vRect
.xLeft
;
896 nHeight
= vRect
.yTop
- vRect
.yBottom
;
903 // Now flush the window style cache and actually go full-screen
905 ::WinSetWindowPos( m_hFrame
914 wxSizeEvent
vEvent( wxSize( nWidth
920 GetEventHandler()->ProcessEvent(vEvent
);
928 m_bFsIsShowing
= FALSE
;
929 Maximize(m_bFsIsMaximized
);
930 ::WinSetWindowULong( (HWND
)GetHWND()
934 ::WinSetWindowPos( m_hFrame
944 } // end of wxTopLevelWindowOS2::ShowFullScreen
946 // ----------------------------------------------------------------------------
947 // wxTopLevelWindowOS2 misc
948 // ----------------------------------------------------------------------------
950 void wxTopLevelWindowOS2::SetIcon(
954 SetIcons(wxIconBundle(rIcon
));
955 } // end of wxTopLevelWindowOS2::SetIcon
957 void wxTopLevelWindowOS2::SetIcons(
958 const wxIconBundle
& rIcons
964 wxTopLevelWindowBase::SetIcons(rIcons
);
966 const wxIcon
& vIcon
= rIcons
.GetIcon(wxSize(32, 32));
968 if (vIcon
.Ok() && vIcon
.GetWidth() == 32 && vIcon
.GetHeight() == 32)
970 ::WinSendMsg( m_hFrame
972 ,(MPARAM
)((HPOINTER
)vIcon
.GetHICON())
975 ::WinSendMsg( m_hFrame
981 } // end of wxTopLevelWindowOS2::SetIcon
983 bool wxTopLevelWindowOS2::EnableCloseButton(
988 // Get system (a.k.a. window) menu
990 HMENU hMenu
= ::WinWindowFromID(m_hFrame
, FID_SYSMENU
);
994 wxLogLastError(_T("GetSystemMenu"));
999 // Enabling/disabling the close item from it also automatically
1000 // disables/enables the close title bar button
1003 (void)::WinSendMsg( hMenu
1005 ,MPFROM2SHORT(SC_CLOSE
, FALSE
)
1006 ,MPFROM2SHORT(MIA_DISABLED
, FALSE
)
1009 (void)::WinSendMsg( hMenu
1011 ,MPFROM2SHORT(SC_CLOSE
, FALSE
)
1012 ,MPFROM2SHORT(MIA_DISABLED
, MIA_DISABLED
)
1016 // Update appearance immediately
1018 ::WinSendMsg( m_hFrame
1024 } // end of wxTopLevelWindowOS2::EnableCloseButton