[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 804
  • Last Modified:

Enddialog on lost focus

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
uffe_thomassen
Asked:
uffe_thomassen
1 Solution
 
jkrCommented:
WM_KILLFOCUS should be the message you're looking for...
0
 
kakamnaCommented:
Overide KillFocus jkr is write
and
GetParentFrame()->DestroyWindow;
0
 
akalmaniCommented:
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
 
jkrCommented:
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
 
uffe_thomassenAuthor Commented:
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now