在子窗口中调用父窗口的成员函数的实例

上传者: flytreeleft | 上传时间: 2021-05-06 21:03:39 | 文件大小: 11.67MB | 文件类型: RAR
在子窗口中调用父窗口的成员函数的方法 1、用FindWindow("类名(可以是派生类)","窗口标题")或GetParent(),二者均能返回父窗口句柄,并能直接使用其成员函数。但是此法只能调用CWnd类里的成员函数,而不能调用自己创建的派生类中的函数。 2、在子窗口的初始化函数里加上父窗口的指针 ,然后在子窗口的类中使用全局变量保存父窗口的指针。如: 父窗口类为CMyDlg(父类为CDialog),子窗口类为CMySon(父类为CDialog),则在CMyDlg::OnInitDialog()中初始化子窗口对象m_myson=new CMySon(this);(m_myson为在父窗口中声明的成员),然后在MySon.cpp中的开始处声明全局变量CMyDlg *parent;(在MySon.h中要加入MyDlg.h头文件),最后在CMySon的构造函数中定义parent=(CMyDlg*)pParent; 好了,现在你可以在子窗口中随时调用父窗口函数了!

文件下载

资源详情

[{"title":"( 85 个子文件 11.67MB ) 在子窗口中调用父窗口的成员函数的实例","children":[{"title":"在子窗口中调用父窗口的成员函数的方法.txt <span style='color:#111;'> 682B </span>","children":null,"spread":false},{"title":"IndepentList","children":[{"title":"wmpclosedcaption.h <span style='color:#111;'> 1.43KB </span>","children":null,"spread":false},{"title":"wmpplaylistcollection.cpp <span style='color:#111;'> 2.22KB </span>","children":null,"spread":false},{"title":"wmpcdromcollection.h <span style='color:#111;'> 1.35KB </span>","children":null,"spread":false},{"title":"wmpnetwork.h <span style='color:#111;'> 2.18KB </span>","children":null,"spread":false},{"title":"StdAfx.cpp <span style='color:#111;'> 214B </span>","children":null,"spread":false},{"title":"resource.h <span style='color:#111;'> 735B </span>","children":null,"spread":false},{"title":"wmpdvd.cpp <span style='color:#111;'> 1.20KB </span>","children":null,"spread":false},{"title":"我的音乐","children":[{"title":"明天会更好.mp3 <span style='color:#111;'> 4.89MB </span>","children":null,"spread":false},{"title":"懂你.mp3 <span style='color:#111;'> 4.91MB </span>","children":null,"spread":false}],"spread":true},{"title":"wmpdvd.h <span style='color:#111;'> 1.19KB </span>","children":null,"spread":false},{"title":"wmpplaylistcollection.h <span style='color:#111;'> 1.59KB </span>","children":null,"spread":false},{"title":"wmpclosedcaption.cpp <span style='color:#111;'> 1.90KB </span>","children":null,"spread":false},{"title":"wmpmedia.cpp <span style='color:#111;'> 3.75KB </span>","children":null,"spread":false},{"title":"IndepentList.dsw <span style='color:#111;'> 593B </span>","children":null,"spread":false},{"title":"IndepentList.plg <span style='color:#111;'> 1.65KB </span>","children":null,"spread":false},{"title":"IndepentList.opt <span style='color:#111;'> 53.50KB </span>","children":null,"spread":false},{"title":"wmperror.cpp <span style='color:#111;'> 1.15KB </span>","children":null,"spread":false},{"title":"wmpsettings.h <span style='color:#111;'> 1.82KB </span>","children":null,"spread":false},{"title":"wmpnetwork.cpp <span style='color:#111;'> 5.45KB </span>","children":null,"spread":false},{"title":"wmpmediacollection.h <span style='color:#111;'> 1.88KB </span>","children":null,"spread":false},{"title":"IndepentList.clw <span style='color:#111;'> 1.19KB </span>","children":null,"spread":false},{"title":"wmpmediacollection.cpp <span style='color:#111;'> 3.60KB </span>","children":null,"spread":false},{"title":"wmpplayerapplication.cpp <span style='color:#111;'> 1.08KB </span>","children":null,"spread":false},{"title":"MyList.h <span style='color:#111;'> 1.19KB </span>","children":null,"spread":false},{"title":"IndepentList.aps <span style='color:#111;'> 34.85KB </span>","children":null,"spread":false},{"title":"IndepentList.h <span style='color:#111;'> 1.36KB </span>","children":null,"spread":false},{"title":"wmpplayer4.h <span style='color:#111;'> 3.23KB </span>","children":null,"spread":false},{"title":"wmpcdrom.h <span style='color:#111;'> 1.23KB </span>","children":null,"spread":false},{"title":"wmperroritem.cpp <span style='color:#111;'> 1.26KB </span>","children":null,"spread":false},{"title":"wmpplaylist.cpp <span style='color:#111;'> 3.12KB </span>","children":null,"spread":false},{"title":"Debug","children":[{"title":"IndepentList.ilk <span style='color:#111;'> 304.73KB </span>","children":null,"spread":false},{"title":"wmpplaylistarray.obj <span style='color:#111;'> 4.64KB </span>","children":null,"spread":false},{"title":"wmpnetwork.obj <span style='color:#111;'> 25.14KB </span>","children":null,"spread":false},{"title":"wmperror.obj <span style='color:#111;'> 5.85KB </span>","children":null,"spread":false},{"title":"vc60.pdb <span style='color:#111;'> 364.00KB </span>","children":null,"spread":false},{"title":"wmpcdrom.obj <span style='color:#111;'> 6.49KB </span>","children":null,"spread":false},{"title":"IndepentList.exe <span style='color:#111;'> 140.10KB </span>","children":null,"spread":false},{"title":"wmpcdromcollection.obj <span style='color:#111;'> 5.61KB </span>","children":null,"spread":false},{"title":"MyList.obj <span style='color:#111;'> 17.65KB </span>","children":null,"spread":false},{"title":"vc60.idb <span style='color:#111;'> 233.00KB </span>","children":null,"spread":false},{"title":"IndepentList.obj <span style='color:#111;'> 15.31KB </span>","children":null,"spread":false},{"title":"IndepentListDlg.obj <span style='color:#111;'> 28.25KB </span>","children":null,"spread":false},{"title":"IndepentList.pdb <span style='color:#111;'> 529.00KB </span>","children":null,"spread":false},{"title":"wmpplayerapplication.obj <span style='color:#111;'> 4.85KB </span>","children":null,"spread":false},{"title":"wmpclosedcaption.obj <span style='color:#111;'> 13.11KB </span>","children":null,"spread":false},{"title":"wmpsettings.obj <span style='color:#111;'> 20.24KB </span>","children":null,"spread":false},{"title":"wmpmedia.obj <span style='color:#111;'> 23.32KB </span>","children":null,"spread":false},{"title":"wmpcontrols.obj <span style='color:#111;'> 14.93KB </span>","children":null,"spread":false},{"title":"IndepentList.pch <span style='color:#111;'> 5.25MB </span>","children":null,"spread":false},{"title":"StdAfx.obj <span style='color:#111;'> 103.52KB </span>","children":null,"spread":false},{"title":"wmpplaylist.obj <span style='color:#111;'> 16.90KB </span>","children":null,"spread":false},{"title":"wmperroritem.obj <span style='color:#111;'> 8.19KB </span>","children":null,"spread":false},{"title":"wmpdvd.obj <span style='color:#111;'> 7.31KB </span>","children":null,"spread":false},{"title":"wmpplayer4.obj <span style='color:#111;'> 53.38KB </span>","children":null,"spread":false},{"title":"wmpmediacollection.obj <span style='color:#111;'> 14.69KB </span>","children":null,"spread":false},{"title":"wmpplaylistcollection.obj <span style='color:#111;'> 9.78KB </span>","children":null,"spread":false},{"title":"wmpstringcollection.obj <span style='color:#111;'> 5.22KB </span>","children":null,"spread":false},{"title":"IndepentList.res <span style='color:#111;'> 2.63KB </span>","children":null,"spread":false}],"spread":false},{"title":"IndepentList.cpp <span style='color:#111;'> 2.10KB </span>","children":null,"spread":false},{"title":"wmpplayerapplication.h <span style='color:#111;'> 1.29KB </span>","children":null,"spread":false},{"title":"wmpcontrols.h <span style='color:#111;'> 1.63KB </span>","children":null,"spread":false},{"title":"ReadMe.txt <span style='color:#111;'> 3.60KB </span>","children":null,"spread":false},{"title":"StdAfx.h <span style='color:#111;'> 1.03KB </span>","children":null,"spread":false},{"title":"wmperroritem.h <span style='color:#111;'> 1.24KB </span>","children":null,"spread":false},{"title":"wmpstringcollection.cpp <span style='color:#111;'> 893B </span>","children":null,"spread":false},{"title":"wmpplaylistarray.h <span style='color:#111;'> 1.28KB </span>","children":null,"spread":false},{"title":"wmpcdromcollection.cpp <span style='color:#111;'> 1.25KB </span>","children":null,"spread":false},{"title":"IndepentList.dsp <span style='color:#111;'> 9.74KB </span>","children":null,"spread":false},{"title":"IndepentList.rc <span style='color:#111;'> 5.88KB </span>","children":null,"spread":false},{"title":"IndepentListDlg.h <span style='color:#111;'> 1.54KB </span>","children":null,"spread":false},{"title":"wmpplayer4.cpp <span style='color:#111;'> 7.73KB </span>","children":null,"spread":false},{"title":"wmpcdrom.cpp <span style='color:#111;'> 1017B </span>","children":null,"spread":false},{"title":"wmpplaylist.h <span style='color:#111;'> 1.70KB </span>","children":null,"spread":false},{"title":"wmpsettings.cpp <span style='color:#111;'> 4.30KB </span>","children":null,"spread":false},{"title":"wmperror.h <span style='color:#111;'> 1.26KB </span>","children":null,"spread":false},{"title":"wmpcontrols.cpp <span style='color:#111;'> 2.81KB </span>","children":null,"spread":false},{"title":"wmpstringcollection.h <span style='color:#111;'> 1.22KB </span>","children":null,"spread":false},{"title":"res","children":[{"title":"IndepentList.rc2 <span style='color:#111;'> 404B </span>","children":null,"spread":false},{"title":"IndepentList.ico <span style='color:#111;'> 1.05KB </span>","children":null,"spread":false}],"spread":false},{"title":"wmpmedia.h <span style='color:#111;'> 1.72KB </span>","children":null,"spread":false},{"title":"IndepentListDlg.cpp <span style='color:#111;'> 3.64KB </span>","children":null,"spread":false},{"title":"wmpplaylistarray.cpp <span style='color:#111;'> 994B </span>","children":null,"spread":false},{"title":"IndepentList.ncb <span style='color:#111;'> 129.00KB </span>","children":null,"spread":false},{"title":"MyList.cpp <span style='color:#111;'> 2.33KB </span>","children":null,"spread":false}],"spread":false}],"spread":true}]

评论信息

  • creamhan :
    很好~~~,正为这个困惑呢.
    2014-07-24
  • candylegend :
    挺好,能运行,就是文件有点多
    2014-03-18
  • fealonelei :
    实例非常好。深受windows 核心编程的影响。
    2014-01-24
  • Drren_Liu :
    多看几遍收获多多,好东西
    2014-01-04
  • wyq8848 :
    之前曾学过这方面的知识,可是忘了很久了,今天看到又有新收获。
    2013-12-08
  • 飞翔_蜗牛 :
    恩,真的很好用。谢谢分享!哈哈
    2013-12-06
  • 306905148 :
    我新手。有点糊涂
    2013-11-29
  • gkang126 :
    还马马虎虎,对我有帮助
    2013-11-06
  • boris6106 :
    还可以,多谢分享,已经在用了
    2013-10-08
  • 乐翔K :
    里面无用的文件太多了,标题中的子窗口调用父窗口这个,只需要从主窗口看一下声明,然后找相应的子窗口,就OK了,方法很正确
    2013-05-22

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明