Solved

Enddialog on lost focus

Posted on 2000-04-11
5
796 Views
Last Modified: 2011-04-14
Hi,

I want close a dialogwindow, when I click outside the dialog window's area.

Iam not using MFC.

Should I use Modal or Modeless Dialog windows.


In which WM_????? should put in EndDialog/DestroyWindow.

0
Comment
Question by:uffe_thomassen
5 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 100 total points
ID: 2704435
WM_KILLFOCUS should be the message you're looking for...
0
 

Expert Comment

by:kakamna
ID: 2704675
Overide KillFocus jkr is write
and
GetParentFrame()->DestroyWindow;
0
 
LVL 3

Expert Comment

by:akalmani
ID: 2706517
Hi !!
    Both Jkr and kakamna are right but regarding Modal or Modeless u can
1) Modal dialog --> It does not give the user to click outside until the user clicks on OK button or Cancel or Esc key.
2) Modeless dialog --> It gives the user to click outside the dialog and there as they said u can trap OnKillFocus() and do the end Dialog.
     
   See which can be best suited for u r requirement.

Bye..
0
 
LVL 86

Expert Comment

by:jkr
ID: 2707598
kakanma - it is *NOT* proper expert protocol to post answers other users have posted as comments.

Please *unlock* the question and refrain from this behaviour in the future!
0
 

Author Comment

by:uffe_thomassen
ID: 2711208
Hi,

I found the solution, perhaps I didn´t explain, my problem precisly. I use a Modeless dialog, but Instead of acting WM_KILLFOCUS, I use:
      case WM_ACTIVATE:
            if((BOOL)LOWORD(wParam) == WA_INACTIVE) {
                  DestroyWindow (hWnd);
                  g_nhWnd =0;
                  return TRUE;
            }
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

679 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