Esempio n. 1
0
LRESULT CProgressDlg::OnCancel(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{ 
  if(m_bFinished)
  {
    GetParent().PostMessage(WM_CLOSE);
    return 0;
  }

  CancelSenderThread();
  CButton m_btnCancel = GetDlgItem(IDCANCEL);
  m_btnCancel.EnableWindow(0);
  return 0;
}
bool ExchangeSenderPipeline::Close(SegmentExecStatus* const exec_status) {
  CancelSenderThread();
  state_.child_->Close(exec_status);
  // free temporary space
  if (NULL != partitioned_data_buffer_) {
    delete partitioned_data_buffer_;
    partitioned_data_buffer_ = NULL;
  }
  if (NULL != block_for_asking_) {
    delete block_for_asking_;
    block_for_asking_ = NULL;
  }
  if (NULL != block_for_serialization_) {
    delete block_for_serialization_;
    block_for_serialization_ = NULL;
  }
  if (NULL != sending_buffer_) {
    delete sending_buffer_;
    sending_buffer_ = NULL;
  }

  if (NULL != block_for_sending_buffer_) {
    delete block_for_sending_buffer_;
    block_for_sending_buffer_ = NULL;
  }
  for (unsigned i = 0; NULL != partitioned_block_stream_ && i < upper_num_;
       i++) {
    if (NULL != partitioned_block_stream_[i]) {
      delete partitioned_block_stream_[i];
      partitioned_block_stream_[i] = NULL;
    }
  }
  if (NULL != partitioned_block_stream_) {
    delete[] partitioned_block_stream_;
    partitioned_block_stream_ = NULL;
  }
  if (NULL != socket_fd_upper_list_) {
    delete[] socket_fd_upper_list_;
    socket_fd_upper_list_ = NULL;
  }
  if (NULL != partition_function_) {
    delete partition_function_;
    partition_function_ = NULL;
  }
  return true;
}
Esempio n. 3
0
LRESULT CProgressDlg::OnCancel(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{ 
  if(m_bFinished)
  {
	  HWND hWndParent = ::GetParent(m_hWnd);
	  ::PostMessage(hWndParent, WM_CLOSE, 0, 0);
    return 0;
  }

  // Start cancelling the worker thread
  CancelSenderThread();  

  // Disable Cancel button
  m_btnCancel.EnableWindow(0);

  return 0;
}