Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Dialog Window

Posted on 2004-04-02
1
Medium Priority
?
842 Views
Last Modified: 2008-02-26
I have dialog with 2 buttons. When I click on button1 a modeless window (windows1)should open in a paritcular position and when i click button2 another modeless window(window2) should open. But when I click button2 windows1 is not getting replaced with windows2. Please refer the code below and tell me i can i do this

void CTestDlg::OnButton1()
{
            
CModless1 *dlg = new CModless1 ();
dlg->Create(IDD_FORMVIEW,this);
dlg->ShowWindow(SW_SHOW);
dlg->SetWindowPos(0,100,0,0,0,SWP_NOSIZE|SWP_SHOWWINDOW);


}

void CTestDlg::OnButton2()
{
CModless2 *dlg = new CModless2 ();
dlg->Create(IDD_FORMVIEW1,this);
dlg->ShowWindow(SW_SHOW);
dlg->SetWindowPos(0,100,0,0,0,SWP_NOSIZE|SWP_SHOWWINDOW);
}
0
Comment
Question by:Gopakumar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
AliYates earned 250 total points
ID: 10763958
You weren't ever destroying the windows you had created. Try using the same variable for both windows.

static CModless1 *dlg = NULL;

void CTestDlg::OnButton1()
{
if (dlg) delete (dlg);          
dlg = new CModless1 ();
dlg->Create(IDD_FORMVIEW,this);
dlg->ShowWindow(SW_SHOW);
dlg->SetWindowPos(0,100,0,0,0,SWP_NOSIZE|SWP_SHOWWINDOW);


}

void CTestDlg::OnButton2()
{
if (dlg) delete (dlg);          
dlg = new CModless2 ();
dlg->Create(IDD_FORMVIEW1,this);
dlg->ShowWindow(SW_SHOW);
dlg->SetWindowPos(0,100,0,0,0,SWP_NOSIZE|SWP_SHOWWINDOW);
}
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Introduction to Processes

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question