On 8 aug, 16:15, David Wilkinson <no-re...@effisols.com> wrote:
RAN wrote:
On more question : I want the propertysheet to modeless and i use :
CSvrSheet o_SvrSheet("Server",0,0);
po_SvrConnectionsPage = new CSvrConnectionsPage;
o_SvrSheet.AddPage (po_SvrConnectionsPage);
m_pMainWnd = &o_SvrSheet;
int nResponse = o_SvrSheet.Create(0,WS_SYSMENU | WS_POPUP |
WS_CAPTION | DS_MODALFRAME | DS_CONTEXTHELP | WS_VISIBLE|
WS_MINIMIZEBOX );
But the propertysheet gets shown for half a second and than
disappeares again !?
What do i have to do to make it work for a modeless propertysheet ?
RAN:
Why do you want a modeless sheet? I would use a modal sheet to replace
the modal dialog.
The reason your property sheet closes is that o_SvrSheet is a local
object, and goes out of scope when your InitInstance() returns. If you
want a modeless sheet, you must make its instance variable a member, or
create it on the heap (and use the "delete this" trick in its
PostNcDestroy() handler).
--
David Wilkinson
Visual C++ MVP- Tekst uit oorspronkelijk bericht niet weergeven -
- Tekst uit oorspronkelijk bericht weergeven -
class CSvrApp : public CWinApp
{
public:
CSvrSheet* po_SvrSheet;
CSvrApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSvrApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CSvrApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
cpp: InitInstance()
po_SvrSheet = new CSvrSheet("Server",0,0);
m_pMainWnd = po_SvrSheet;
int nResponse = po_SvrSheet->Create(NULL,WS_SYSMENU | WS_POPUP |
WS_CAPTION | DS_MODALFRAME | DS_CONTEXTHELP | WS_VISIBLE|
WS_MINIMIZEBOX );
I think its an member now, but it still disappears, must be another
newbie blunder...
You are probably returning FALSE from InitInstance(). Dialog apps using
a modal dialog do this because the main window has already closed.
the way to go. You're just replacing dialog with property sheet; don't
rock the boat by trying to do things differently.