123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- // SendDataDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "LYFZIPManage.h"
- #include "SendDataDlg.h"
- #include "ConnectDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- extern HWND g_hSendWnd;
- /////////////////////////////////////////////////////////////////////////////
- // SendDataDlg dialog
- SendDataDlg::SendDataDlg(CWnd* pParent /*=NULL*/)
- : CDialog(SendDataDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(SendDataDlg)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- pData=NULL;
- m_trytimes=0;
- }
- void SendDataDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(SendDataDlg)
- // NOTE: the ClassWizard will add DDX and DDV calls here
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(SendDataDlg, CDialog)
- //{{AFX_MSG_MAP(SendDataDlg)
- ON_WM_TIMER()
- ON_WM_DESTROY()
- ON_WM_CLOSE()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // SendDataDlg message handlers
- void SendDataDlg::OnOK()
- {
- // TODO: Add extra validation here
- }
- void SendDataDlg::OnCancel()
- {
- // TODO: Add extra cleanup here
- }
- BOOL SendDataDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // TODO: Add extra initialization here
- g_bSendOK=1;
- g_hSendWnd=m_hWnd;
- SetTimer(1, 100, NULL);
- SetTimer(2, 10000, NULL);
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- HWND g_hConnectWnd=NULL;
- extern BOOL g_bNeedCoon;
- void SendDataDlg::OnTimer(UINT nIDEvent)
- {
- // TODO: Add your message handler code here and/or call default
- if(nIDEvent==1)
- {
- KillTimer(nIDEvent);
- ll: if(g_bNeedCoon)
- {
- CConnectDlg dlg;
- dlg.DoModal();
- if(g_bSendOK)
- g_bNeedCoon=0;
- else
- return;
- }
- if(pData)
- {
- if(g_pMainWnd->ProcessChatMessageRequest((void*)pData, length)==0)
- {
- g_bNeedCoon=1;
- goto ll;
- }
- }
- else if(sql.IsEmpty ())
- {
- if(g_pMainWnd->ProcessChatMessageRequest(&code, sizeof(BYTE))==0)
- {
- g_bNeedCoon=1;
- goto ll;
- }
- }
- else
- {
- const char *szDataBuf = sql.GetBuffer(0);
- sql.ReleaseBuffer();
- if(g_pMainWnd->ProcessChatMessageRequest((void*)szDataBuf, strlen(szDataBuf) + 1)==0)
- {
- g_bNeedCoon=1;
- goto ll;
- }
- }
- g_bSendOK=1;
- }
- else if(nIDEvent==2)
- {
- KillTimer(2);
- g_bSendOK=0;g_bNeedCoon=1;
- if(g_hConnectWnd)
- ::SendMessage (g_hConnectWnd, WM_CLOSE, 0, 0);
-
- // MessageBox("fd");
- SetTimer(1, 10, NULL);
- }
- }
- void SendDataDlg::OnDestroy()
- {
- // MessageBox("");
- CDialog::OnDestroy();
- // TODO: Add your message handler code here
- g_hSendWnd=NULL;
- }
- void SendDataDlg::OnClose()
- {
- // TODO: Add your message handler code here and/or call default
- // MessageBox("close message");
- CDialog::OnCancel ();g_hSendWnd=NULL;
- }
|