MFC MDI Master Framework and tabbed data interoperability

Source: Internet
Author: User

================================== Declaration ==================================

This article is original, reproduced in the text of the influential annotated author and source, and to ensure the integrity of the article.

Do not modify (including this statement) without the consent of the author, and reserve the right of legal investigation.

Do not use academic references without the consent of the author.

Do not use for commercial publication, commercial printing or commercial reference without the consent of the author.

In order to ensure the correct contents, we suggest that we should read the original text.

This article link: http://www.cnblogs.com/wlsandwho/p/4389576.html

=======================================================================

For the Peace of the universe, or take my magic to change the series to say things!

The content of this article is based on http://www.cnblogs.com/wlsandwho/p/4282242.html

=======================================================================

The custom template view of MDI was implemented successfully before.

Now, if there is a CListCtrl control on a tab page, how do you make the data stored in the main frame window appear in CListCtrl? or enable the data in the CListCtrl to be used in the main frame window?

=======================================================================

There are hundreds of thousands of things in the world, er, the solution to the problem has tens of thousands of species, I only choose a simple grasp of the big, yingying a grip.

=======================================================================

Here I choose the way to use user-defined messages.

1 simple.

2 lazy.

3 comes with a queue.

4 It doesn't matter if it doesn't respond, just send it again.

5 The child view sends the request to the main frame to execute, after all the data is there.

=======================================================================

Approximate code, not necessarily can be used, after all, after disinfection ha da.

Code location we all know.

1 #define Wm_wls_lalala    wm_user+321
1 voidCxxxfv::onnmclicklistrecordinfo (NMHDR *pnmhdr, LRESULT *PResult)2 {3Lpnmitemactivate pnmitemactivate = reinterpret_cast<lpnmitemactivate>(PNMHDR);4     //TODO: Add control notification handler code here5 6     if(M_listctrl.getnextitem (-1, Lvni_all | lvni_selected)! =-1)7     {8          intNitem =m_listctrl.getnextitem (-1, Lvni_all |lvni_selected);9 Tencstring* pstrxx=NewCString; One*pstrsampleid=m_listctrl.getitemtext (Nitem,1); A  -         intNtype=1; -  the::P Ostmessage (theapp.m_pmainwnd->M_hwnd,wm_wls_lalala, (WPARAM) Pstrxx, (LPARAM) nType); -     } -  -*presult =0; +}
On_message (WM_DATA_EXCHANGE,&CMAINFRAME::ONXXX)
1 LRESULT cmainframe::onxxx (WPARAM WPARAM, LPARAM LPARAM)2 {3     intNtype= (int) LParam;4  5     if(ntype==1)6     {7CString strxxx=* (cstring*) WParam;8 9         //Blablabla ...Ten     } One      A     Delete(cstring*) WParam; -  -     return 0;  the}

It is important to note that PostMessage is using the API. With PostMessage instead of SendMessage.

After all, the accuracy of the data is also very important.

MFC MDI Master Framework and tabbed data interoperability

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.