?
Solved

MDI application with multiple forms

Posted on 2003-02-24
10
Medium Priority
?
264 Views
Last Modified: 2013-11-20
Hi;
I have two forms in Application. In each form
I have a button called exit. I want to close
the corresponding form when I click on the
exit button. How can I handle this?

I tried to trigger OnClose() and OnDestroy()
functions from the exit button click event but
obviously that didn't work. What should i do?
Please help me

0
Comment
Question by:Ashik
[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
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 8007236
PostMessage(WM_CLOSE, 0, 0);
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 8007310
Call CDialog::OnOK on CDialog::OnCancel

Good Luck
0
 
LVL 2

Accepted Solution

by:
kozmo_jonny earned 400 total points
ID: 8007460
by writing: PostMessage(WM_CLOSE, 0, 0);

its the same as writing "OnClose()",

what u should write is:

GetParent()->PostMessage(WM_CLOSE, 0, 0);
0
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 
LVL 23

Expert Comment

by:Roshan Davis
ID: 8007562
sorry it was a spelling mistake...

Call CDialog::OnOK
Or CDialog::OnCancel

Good Luck
0
 
LVL 2

Expert Comment

by:kozmo_jonny
ID: 8007576
roshmon:

if u would have checked your code before applying it here u would have got the following message:

error C2248: 'OnOK' : cannot access protected member declared in class 'CDialog'
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 8007610
I think the questioner is saying 'form' for the derived class of CDialog (May be he is a VB programmer).

thats Y I commented like that.

Roshmon
0
 
LVL 2

Expert Comment

by:kozmo_jonny
ID: 8007775
u'r right, but this is not the VB section, but the MFC section.

ciao
0
 

Author Comment

by:Ashik
ID: 8008036
Hi Mr. Kozmo Jonny
It is working fine .....
GetParent()->PostMessage(WM_CLOSE, 0, 0);
Thanks a lot
0
 
LVL 2

Expert Comment

by:kozmo_jonny
ID: 8008089
all u need 2do now is hand in the points ;-)))

u'r more than welcome
0
 

Author Comment

by:Ashik
ID: 8093699
Hi;
GetParent()->PostMessage(WM_CLOSE, 0, 0);
worked fine
0

Featured Post

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

765 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