home *** CD-ROM | disk | FTP | other *** search
/ ftp.funduc.com / 2014.08.ftp.funduc.com.tar / ftp.funduc.com / fshedcode102502.zip / PasteSpecialDlg.cpp < prev    next >
C/C++ Source or Header  |  2001-11-29  |  2KB  |  79 lines

  1. // PasteSpecialDlg.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "fshed.h"
  6. #include "PasteSpecialDlg.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CPasteSpecialDlg dialog
  16.  
  17.  
  18. CPasteSpecialDlg::CPasteSpecialDlg(CWnd* pParent /*=NULL*/)
  19.     : CDialog(CPasteSpecialDlg::IDD, pParent)
  20. {
  21.     //{{AFX_DATA_INIT(CPasteSpecialDlg)
  22.     m_strClipText = _T("");
  23.     m_nNumTimes = 1;
  24.     m_nInsertMode = 1;
  25.     m_nSkipBytes = 0;
  26.     m_bPasteAsText = TRUE;
  27.     //}}AFX_DATA_INIT
  28. }
  29.  
  30.  
  31. void CPasteSpecialDlg::DoDataExchange(CDataExchange* pDX)
  32. {
  33.     CDialog::DoDataExchange(pDX);
  34.     //{{AFX_DATA_MAP(CPasteSpecialDlg)
  35.     DDX_Text(pDX, IDC_CLIP_TEXT_ED, m_strClipText);
  36.     DDX_Text(pDX, IDC_NUM_TIMES_ED, m_nNumTimes);
  37.     DDV_MinMaxInt(pDX, m_nNumTimes, 1, 1000000);
  38.     DDX_Radio(pDX, IDC_OVERWRITE_RB, m_nInsertMode);
  39.     DDX_Text(pDX, IDC_SKIP_BYTES_ED, m_nSkipBytes);
  40.     DDV_MinMaxInt(pDX, m_nSkipBytes, 0, 1000000);
  41.     DDX_Check(pDX, IDC_AS_TEXT_CHK, m_bPasteAsText);
  42.     //}}AFX_DATA_MAP
  43. }
  44.  
  45.  
  46. BEGIN_MESSAGE_MAP(CPasteSpecialDlg, CDialog)
  47.     //{{AFX_MSG_MAP(CPasteSpecialDlg)
  48.     //}}AFX_MSG_MAP
  49. END_MESSAGE_MAP()
  50.  
  51. /////////////////////////////////////////////////////////////////////////////
  52. // CPasteSpecialDlg message handlers
  53.  
  54. BOOL CPasteSpecialDlg::OnInitDialog() 
  55. {
  56.     if (OpenClipboard())
  57.     {
  58.         HGLOBAL hClipMemory = GetClipboardData (CF_TEXT);
  59.         if (hClipMemory != NULL)
  60.         {
  61.             int gsize = GlobalSize (hClipMemory);
  62.             if (gsize > 0)
  63.             {
  64.                 char* pClipMemory = (char*) GlobalLock (hClipMemory);
  65.                 memcpy (m_strClipText.GetBuffer(gsize), pClipMemory, gsize);
  66.             m_strClipText.ReleaseBuffer(gsize);
  67.         }
  68.             GlobalUnlock (hClipMemory);
  69.         }
  70.         CloseClipboard ();
  71.     }
  72.     CDialog::OnInitDialog();
  73.     
  74.     // TODO: Add extra initialization here
  75.     
  76.     return TRUE;  // return TRUE unless you set the focus to a control
  77.                   // EXCEPTION: OCX Property Pages should return FALSE
  78. }
  79.