Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

send message

29 views
Skip to first unread message

mido1971

unread,
Oct 9, 2006, 7:34:02 AM10/9/06
to
i have a dialog created with this code

CreateEx(0, NULL, NULL, WS_POPUP|WS_VISIBLE, CRect(pt,CSize(0,0)),
pParentWnd, nID);
CRect Rect2(10,85,80,110);
m_Close.Create("Close",WS_CHILD|WS_VISIBLE|BS_CENTER |BS_NOTIFY
,Rect2,this,IDC_CLOSE); // button
CRect Rect(120,85,190,110);
m_Open.Create("Open",WS_CHILD|WS_VISIBLE|BS_CENTER |BS_NOTIFY
,Rect,this,IDC_OPEN); // button

when i click one of the two button i send message with this code

TBNOTIFY mm;
mm.hdr.code = NM_CLICK;
mm.hdr.hwndFrom = m_hWnd;
mm.hdr.idFrom = GetDlgCtrlID();
mm.iItem = 2;
mm.cchText = 5;
mm.pszText = "Close";

SendMessage(WM_NOTIFY, mm.hdr.idFrom, (LPARAM)&mm)

Where the owner windows get the message with this function.

OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)

I used the formview to be the owner but I found that if I open a new dialog
with do modal() the first dialog will be disabled

Can I use sendmessage to mainframe and how can I do it or how can I modify
the dialog to be usable in all the program and in the first lave always
thanks

Scot T Brennecke

unread,
Oct 9, 2006, 9:50:07 AM10/9/06
to
It sounds like perhaps you want your dialog to be modeless, rather than modal. But it's not clear
to me from reading your description below what the relationship of the "dialog" and the "formview"
are, and which window is sending the message, nor when you are calling DoModal.

"mido1971" <mido...@discussions.microsoft.com> wrote in message
news:874EF731-C164-4F1B...@microsoft.com...

mido1971

unread,
Oct 9, 2006, 2:23:02 PM10/9/06
to

the first dialog send the message , and its works well where this dialog
work in condition and timer and
it look like msn message notify , but the problem is if i open a new dialog
the first dialog (msn message notify)
lost the focus and i can't click the butons i tred to make the cmainfram the
owner but i didnt get teh message wm_notify
that is thanks

Scot T Brennecke

unread,
Oct 10, 2006, 7:21:52 PM10/10/06
to
When you call DoModal, the parent window and its other children are all disabled, so that the modal
dialog is the only child that can be used. That is the meaning of "modal", and it's required to be
that way. But if you use a modeless dialog (via Create instead of DoModal), the parent is not
disabled, and the modeless dialog can be used alongside the parent or siblings. Care must be taken
to understand the differences in lifetime of objects when doing modeless instead of modal dialogs,
but it seems that is the solution you seek.

"mido1971" <mido...@discussions.microsoft.com> wrote in message

news:620DFD58-D8DE-47ED...@microsoft.com...

mido1971

unread,
Oct 11, 2006, 3:33:02 PM10/11/06
to
yes i am with you if i do modeless dialog but i need to do DoModal

i think CWnd* pOwner= AfxGetMainWnd(); instead of CWnd* pOwner=GetOwner( );
where the ownre in this casa is the main frame

but i dont know if its corect or not

0 new messages