DelFriendDlg.cpp
上传用户:zslianheng
上传日期:2013-04-03
资源大小:946k
文件大小:3k
源码类别:

Linux/Unix编程

开发平台:

Visual C++

  1. /***************************************************************************
  2.  *                                                                         *
  3.  *   This program is free software; you can redistribute it and/or modify  *
  4.  *   it under the terms of the GNU General Public License as published by  *
  5.  *   the Free Software Foundation; either version 2 of the License, or     *
  6.  *   (at your option) any later version.                                   *
  7.  *                                                                         *
  8.  *   copyright            : (C) 2002 by Zhang Yong                         *
  9.  *   email                : z-yong163@163.com                              *
  10.  ***************************************************************************/
  11. // DelFriendDlg.cpp : implementation file
  12. //
  13. #include "stdafx.h"
  14. #include "myicq.h"
  15. #include "DelFriendDlg.h"
  16. #include "ViewDetailDlg.h"
  17. #include "icqlink.h"
  18. #include "serversession.h"
  19. #ifdef _DEBUG
  20. #define new DEBUG_NEW
  21. #undef THIS_FILE
  22. static char THIS_FILE[] = __FILE__;
  23. #endif
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CDelFriendDlg dialog
  26. CDelFriendDlg::CDelFriendDlg(uint32 uin, CWnd* pParent /*=NULL*/)
  27. : CMyDlg(CDelFriendDlg::IDD, pParent), IcqWindow(WIN_DEL_FRIEND, uin)
  28. {
  29. //{{AFX_DATA_INIT(CDelFriendDlg)
  30. // NOTE: the ClassWizard will add member initialization here
  31. //}}AFX_DATA_INIT
  32. }
  33. void CDelFriendDlg::onAck(uint32 seq)
  34. {
  35. EndDialog(IDOK);
  36. }
  37. void CDelFriendDlg::onSendError(uint32 seq)
  38. {
  39. GetDlgItem(IDC_DEL_FRIEND)->EnableWindow(TRUE);
  40. CString str;
  41. str.LoadString(IDS_TIMEOUT);
  42. SetDlgItemText(IDC_MSG, str);
  43. m_btnPic.stop();
  44. }
  45. void CDelFriendDlg::DoDataExchange(CDataExchange* pDX)
  46. {
  47. CMyDlg::DoDataExchange(pDX);
  48. //{{AFX_DATA_MAP(CDelFriendDlg)
  49. DDX_Control(pDX, IDC_PIC, m_btnPic);
  50. //}}AFX_DATA_MAP
  51. }
  52. BEGIN_MESSAGE_MAP(CDelFriendDlg, CMyDlg)
  53. //{{AFX_MSG_MAP(CDelFriendDlg)
  54. ON_BN_CLICKED(IDC_DEL_FRIEND, OnDelFriend)
  55. ON_BN_CLICKED(IDC_PIC, OnPic)
  56. //}}AFX_MSG_MAP
  57. END_MESSAGE_MAP()
  58. /////////////////////////////////////////////////////////////////////////////
  59. // CDelFriendDlg message handlers
  60. void CDelFriendDlg::OnDelFriend() 
  61. {
  62. seq = serverSession()->delFriend(uin);
  63. GetDlgItem(IDC_DEL_FRIEND)->EnableWindow(FALSE);
  64. CString str;
  65. str.LoadString(IDS_DEL_FRIEND);
  66. SetDlgItemText(IDC_MSG, str);
  67. m_btnPic.start();
  68. }
  69. BOOL CDelFriendDlg::OnInitDialog() 
  70. {
  71. CMyDlg::OnInitDialog();
  72. SetDlgItemInt(IDC_UIN, uin, FALSE);
  73. IcqContact *contact = icqLink->findContact(uin);
  74. if (contact)
  75. SetDlgItemText(IDC_NICK, contact->nick.c_str());
  76. m_btnPic.setImageList(&getApp()->largeImageList, getApp()->nrFaces);
  77. OnDelFriend();
  78. return TRUE;  // return TRUE unless you set the focus to a control
  79.               // EXCEPTION: OCX Property Pages should return FALSE
  80. }
  81. void CDelFriendDlg::OnPic() 
  82. {
  83. CViewDetailDlg *win = new CViewDetailDlg(uin);
  84. win->Create(this);
  85. }