n Mon, 1 Feb 2010 20:25:44 -0800 (PST), Woody < XXXX@XXXXX.COM > wrote:
You don't have an option. You *MUST* provide them! And they must do NOTHING! If you
want 'ESC' to do something, you must handle it in the OnCancel, but you must NOT, under
any conditions, call CDialog::OnOK or CDialog::OnCancel as a consequence. These only work
correctly in modal dialogs. A modeless dialog handler MUST override these virtual methods
and no matter what it does, it must not call the superclass methods. This is because the
superclass methods call ::EndDialog, whose behavior is undefined for modeless dialogs.
But part of the answer depends on seeing the declaration. In general, you must not show
code that has "unbound variables", that is, variables for which we do not see the
The code was nearly unreadable.
>> This converts the screen coordinates of GetWindowRect to the client coordinates of >.
>Finally, we get to the point. It is undoubtedly a question >f
>coordinates, but not just screen to client. As I said, I did try thi>,
>and it positions the window incorrectly.
WHatever that means. It actually is important to know what it did. Was the box to the
left and above, or to the right and below, or what?
>> This presumes your modeless dialog is done as a popup, by the way, and you have sa>>
>> nothing about how this window is managed. t would probably make more sense to create t>>
>> dialog as a child windo>.
>The modeless dialog has the following styles (as shown by Spy++>:
>WS_CAPTION, WS_VISIBLE, WS_CLIPSIBLINGS, WS_OVERLAPPED, DS_3DLOO>,
>DS_FIXEDSYS, DS_SETFONT, WS_EX_ LEFT, WS_EX_LTRREADIN>,
>WS_EX_RIGHTSCROLLBAR, WS_EX_TOOLWINDOW, WS_EX_WINDOWEDG>,
>WS_EX_CONTROLPARENT, WS_EX_STATICEDGE. Spy++ shows its parent >s
>(none), although the dialog F was specified in the Create call.
There is some total weirdness dealing with parents of modeless dialogs, done within MFC. I
found that it attaches all dialogs to the main window as a parent, no matter what you
specify in the Create call.
But without knowing what you intend, it isn't easy to figure out what the correct answer
is. I wouldn't have done it with a modeless popup dialog.
>> Actually, it should probably be a child windo>.
>It was created using VS2005 dialog editor. I left the style choice >s
>"overlapped" (the default), but I can try "child>.
>The issue may be complicated by the fact that I'm testing this on t>e
>primary monitor of a dual-monitor system.
That can have problems in some cases, but I suspect the child property is the one you
>> Note also that unless the dialog is a child (not a popup), when you move the pare>>
>> dialog, the modeless dialog window will stay where it was, unless you also impleme>>
>> MoveWindow to move it. nd if you resize the window to cover some of the controls, t>>
>> modeless dialog will still appear on top of the window; it will not be clipped by t>>
>> parent windo>.
>These properties are OK, but I do want to get the coords correct, so>I
>will try the "child" approac>.gt;>>
>>o what do you intend he>e?>
>In MS Word 97, the Find dialog's behavior is what I'm after.>It
>behaves as a window which remains on top of the main window, can>be