799 lines
21 KiB
C++
799 lines
21 KiB
C++
// DLG_CheckUp_Mms_See.cpp : implementation file
|
||
//
|
||
|
||
#include "stdafx.h"
|
||
#include "smsmanager.h"
|
||
#include "DLG_CheckUp_Mms_See.h"
|
||
|
||
#ifdef _DEBUG
|
||
#define new DEBUG_NEW
|
||
#undef THIS_FILE
|
||
static char THIS_FILE[] = __FILE__;
|
||
#endif
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// DLG_CheckUp_Mms_See dialog
|
||
|
||
#include "MainFrm.h"
|
||
#include "CheckupMmsDlg.h"
|
||
|
||
|
||
DLG_CheckUp_Mms_See::DLG_CheckUp_Mms_See(CWnd* pParent /*=NULL*/)
|
||
: CDialog(DLG_CheckUp_Mms_See::IDD, pParent)
|
||
, m_str_Audit_YYSStatus(_T(""))
|
||
, m_str_Audit_Time(_T(""))
|
||
, m_str_Audit_SubmitID(_T(""))
|
||
, m_str_Audit_Status(_T(""))
|
||
, m_str_Audit_Opinion(_T(""))
|
||
{
|
||
//{{AFX_DATA_INIT(DLG_CheckUp_Mms_See)
|
||
m_strCorpID = _T("");
|
||
m_strSize = _T("");
|
||
m_strSubTime = _T("");
|
||
m_strTitle = _T("");
|
||
//}}AFX_DATA_INIT
|
||
|
||
m_pDlg = (CCheckupMmsDlg *)pParent;
|
||
m_pMainFrame = NULL;
|
||
memset(&m_Mms,0,sizeof(m_Mms));
|
||
m_pMmsBuf=NULL;
|
||
m_lMmsSize=0;
|
||
m_bMmsOK = false;
|
||
|
||
memset(&m_MMS_Head , 0 , sizeof(m_MMS_Head));
|
||
memset(&m_MMS_Z , 0 , sizeof(m_MMS_Z));
|
||
m_MMS_CurZ = 0;
|
||
}
|
||
|
||
|
||
void DLG_CheckUp_Mms_See::DoDataExchange(CDataExchange* pDX)
|
||
{
|
||
CDialog::DoDataExchange(pDX);
|
||
//{{AFX_DATA_MAP(DLG_CheckUp_Mms_See)
|
||
DDX_Control(pDX, IDC_CHECKUPSEE_Z, m_S_Msg);
|
||
DDX_Text(pDX, IDC_CHECKUPSEE_CORPID, m_strCorpID);
|
||
DDX_Text(pDX, IDC_CHECKUPSEE_SIZE, m_strSize);
|
||
DDX_Text(pDX, IDC_CHECKUPSEE_SUBTIME, m_strSubTime);
|
||
DDX_Text(pDX, IDC_CHECKUPSEE_TITLE, m_strTitle);
|
||
//}}AFX_DATA_MAP
|
||
DDX_Text(pDX, IDC_CHECKUPSEE_AUDIT_YYSSTATUS, m_str_Audit_YYSStatus);
|
||
DDX_Text(pDX, IDC_CHECKUPSEE_AUDIT_TIME, m_str_Audit_Time);
|
||
DDX_Text(pDX, IDC_CHECKUPSEE_AUDIT_SUBMITID, m_str_Audit_SubmitID);
|
||
DDX_Text(pDX, IDC_CHECKUPSEE_AUDIT_STATUS, m_str_Audit_Status);
|
||
DDX_Text(pDX, IDC_CHECKUPSEE_AUDIT_OPTINION, m_str_Audit_Opinion);
|
||
}
|
||
|
||
|
||
BEGIN_MESSAGE_MAP(DLG_CheckUp_Mms_See, CDialog)
|
||
//{{AFX_MSG_MAP(DLG_CheckUp_Mms_See)
|
||
ON_BN_CLICKED(IDC_CHECKUPSEE_UP, OnCheckupseeUp)
|
||
ON_BN_CLICKED(IDC_CHECKUPSEE_DOWN, OnCheckupseeDown)
|
||
//}}AFX_MSG_MAP
|
||
ON_BN_CLICKED(IDC_CHECKUPSEE_COPYTXT, &DLG_CheckUp_Mms_See::OnBnClickedCheckupseeCopytxt)
|
||
ON_BN_CLICKED(IDC_CHECKUPSEE_SAVEBMP, &DLG_CheckUp_Mms_See::OnBnClickedCheckupseeSavebmp)
|
||
ON_BN_CLICKED(IDC_CHECKUPSEE_SAVEMIDI, &DLG_CheckUp_Mms_See::OnBnClickedCheckupseeSavemidi)
|
||
ON_BN_CLICKED(IDC_CHECKUPSEE_SAVEMMS, &DLG_CheckUp_Mms_See::OnBnClickedCheckupseeSavemms)
|
||
END_MESSAGE_MAP()
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// DLG_CheckUp_Mms_See message handlers
|
||
|
||
void DLG_CheckUp_Mms_See::SetParam(ANS_REQ_Mms_GetFile2 mms, BYTE *pBuf, long lBufLen,CMainFrame * pMainFrame)
|
||
{
|
||
m_Mms=mms;
|
||
m_pMmsBuf=pBuf;
|
||
m_lMmsSize=lBufLen;
|
||
m_pMainFrame = pMainFrame;
|
||
}
|
||
|
||
BOOL DLG_CheckUp_Mms_See::OnInitDialog()
|
||
{
|
||
CDialog::OnInitDialog();
|
||
|
||
// TODO: Add extra initialization here
|
||
|
||
m_strCorpID.Format(_T("%d") , m_Mms.lCorpID );
|
||
m_strTitle = m_Mms.szTitle;
|
||
m_strSize.Format(_T("%.2fk") , (float)m_Mms.lmmSize/1024.0f );
|
||
m_strSubTime.Format(_T("%04d.%02d.%02d %02d:%02d") , m_Mms.tCreateTime.wYear,m_Mms.tCreateTime.wMonth,m_Mms.tCreateTime.wDay,m_Mms.tCreateTime.wHour,m_Mms.tCreateTime.wMinute);
|
||
|
||
if (m_Mms.lMmsType == 1) //<2F><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>
|
||
{
|
||
m_str_Audit_Status = CCheckupMmsDlg::GetStatus(m_Mms.Audit_Status);
|
||
m_str_Audit_SubmitID = m_Mms.Audit_SubmitID;
|
||
m_str_Audit_Time.Format(_T("%04d.%02d.%02d %02d:%02d"), m_Mms.Audit_Cmcc_Time.wYear, m_Mms.Audit_Cmcc_Time.wMonth, m_Mms.Audit_Cmcc_Time.wDay, m_Mms.Audit_Cmcc_Time.wHour, m_Mms.Audit_Cmcc_Time.wMinute);
|
||
m_str_Audit_Opinion = m_Mms.Audit_Opinion;
|
||
m_str_Audit_YYSStatus = _T("<EFBFBD>ƶ<EFBFBD>:");
|
||
m_str_Audit_YYSStatus.Append(CCheckupMmsDlg::GetStatus(m_Mms.Audit_Cmcc_Status));
|
||
m_str_Audit_YYSStatus.Append(_T(";<3B><>ͨ:"));
|
||
m_str_Audit_YYSStatus.Append(CCheckupMmsDlg::GetStatus(m_Mms.Audit_Unicom_Status));
|
||
m_str_Audit_YYSStatus.Append(_T(";<3B><><EFBFBD><EFBFBD>:"));
|
||
m_str_Audit_YYSStatus.Append(CCheckupMmsDlg::GetStatus(m_Mms.Audit_Telcom_Status));
|
||
GetDlgItem(IDC_CHECKUPSEE_AUDIT_YYSSTATUS)->ShowWindow(SW_SHOW);
|
||
}
|
||
|
||
UpdateData(false);
|
||
|
||
|
||
//<2F><><EFBFBD><EFBFBD>
|
||
m_Html.CreateFromStatic(IDC_CHECKUPSEE_HTML, this);
|
||
m_Html.Navigate(_T("about:blank"),navNoHistory); //Ĭ<>ϴհ<F2BFAABF><D5B0><EFBFBD>ҳ
|
||
m_Html.SetSilent(true); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>ڡ<EFBFBD>
|
||
|
||
m_bMmsOK = ReadMms();
|
||
m_MMS_CurZ =0;
|
||
Mms_Showmm();
|
||
if ( !m_pMainFrame->GetUserPurview(PURVIEW_MANAGER_ADD,false) ) //û<>й<EFBFBD><D0B9><EFBFBD>ԱȨ<D4B1>ޣ<EFBFBD><DEA3><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||
{
|
||
//GetDlgItem(IDC_CHECKUPSEE_COPYTXT)->ShowWindow(SW_HIDE);
|
||
GetDlgItem(IDC_CHECKUPSEE_SAVEMMS)->ShowWindow(SW_HIDE);
|
||
//GetDlgItem(IDC_CHECKUPSEE_SAVEBMP)->ShowWindow(SW_HIDE);
|
||
//GetDlgItem(IDC_CHECKUPSEE_SAVEMIDI)->ShowWindow(SW_HIDE);
|
||
}
|
||
|
||
return TRUE; // return TRUE unless you set the focus to a control
|
||
// EXCEPTION: OCX Property Pages should return FALSE
|
||
}
|
||
|
||
BOOL DLG_CheckUp_Mms_See::ReadMms()
|
||
{
|
||
BOOL bRead=true;
|
||
BYTE * p = m_pMmsBuf;
|
||
long lmmSizeCount=0;
|
||
memset(&m_MMS_Head , 0 , sizeof(m_MMS_Head));
|
||
memset(&m_MMS_Z , 0 , sizeof(m_MMS_Z));
|
||
|
||
int lVer = 0;
|
||
memcpy(&lVer , p , sizeof(lVer));p=p+sizeof(lVer);
|
||
if ( lVer == MOBSET_MMS_VER_1 )
|
||
{
|
||
MMS_Head_1 MMS_Head;
|
||
MMS_Z_1 MMS_Z[MOBSET_MMS_MAX_Z]={0};
|
||
MMS_Head.lVer = lVer;
|
||
memcpy(((BYTE*)&MMS_Head)+sizeof(MMS_Head.lVer) , p , sizeof(MMS_Head)-sizeof(MMS_Head.lVer)); p = p+sizeof(MMS_Head)-sizeof(MMS_Head.lVer);
|
||
|
||
if ( MMS_Head.lVer == MOBSET_MMS_VER_1 && MMS_Head.lSize == m_Mms.lmmSize && MMS_Head.lZCount>=0 && MMS_Head.lZCount<=MOBSET_MMS_MAX_Z ) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>
|
||
{
|
||
for ( int i=0 ; i<MMS_Head.lZCount ; i++ )
|
||
{
|
||
memcpy(&MMS_Z[i] , p , sizeof(MMS_Z_1));p=p+sizeof(MMS_Z_1);
|
||
if ( MMS_Z[i].lVer == MOBSET_MMS_VER_1 ) //<2F>ж<EFBFBD>ͷ<EFBFBD>Ǻϸ<C7BA>
|
||
{
|
||
//<2F>ָ<EFBFBD>3gp
|
||
if ( MMS_Z[i].l3gpSize>0 )
|
||
{
|
||
#if defined(_M_X64)
|
||
MMS_Z[i].p3gp = (int)p;
|
||
#else
|
||
MMS_Z[i].p3gp = p;
|
||
#endif
|
||
p=p+MMS_Z[i].l3gpSize;
|
||
}
|
||
//<2F>ָ<EFBFBD>bmp
|
||
if ( MMS_Z[i].lBmpSize>0 )
|
||
{
|
||
#if defined(_M_X64)
|
||
MMS_Z[i].pBmp = (int)p;
|
||
#else
|
||
MMS_Z[i].pBmp = p;
|
||
#endif
|
||
p=p+MMS_Z[i].lBmpSize;
|
||
}
|
||
//<2F>ָ<EFBFBD>midi
|
||
if ( MMS_Z[i].lMidiSize>0 )
|
||
{
|
||
#if defined(_M_X64)
|
||
MMS_Z[i].pMidi = (int)p;
|
||
#else
|
||
MMS_Z[i].pMidi = p;
|
||
#endif
|
||
p=p+MMS_Z[i].lMidiSize;
|
||
}
|
||
//<2F>ָ<EFBFBD>txt
|
||
if ( MMS_Z[i].lTxtSize>0 )
|
||
{
|
||
#if defined(_M_X64)
|
||
MMS_Z[i].pTxt = (int)p;
|
||
#else
|
||
MMS_Z[i].pTxt = p;
|
||
#endif
|
||
p=p+MMS_Z[i].lTxtSize;
|
||
}
|
||
lmmSizeCount = lmmSizeCount+MMS_Z[i].l3gpSize+MMS_Z[i].lBmpSize+MMS_Z[i].lMidiSize+MMS_Z[i].lTxtSize;
|
||
}
|
||
else
|
||
{
|
||
bRead = false;
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
if ( bRead ) //<2F>汾ת<E6B1BE><D7AA>
|
||
{
|
||
CSendPub::MMS_ChangeVer(&m_MMS_Head,&m_MMS_Z[0],&MMS_Head,&MMS_Z[0]);
|
||
}
|
||
}
|
||
if ( lVer == MOBSET_MMS_VER_2 )
|
||
{
|
||
m_MMS_Head.lVer = lVer;
|
||
memcpy(((BYTE*)&m_MMS_Head)+sizeof(m_MMS_Head.lVer) , p , sizeof(m_MMS_Head)-sizeof(m_MMS_Head.lVer)); p = p+sizeof(m_MMS_Head)-sizeof(m_MMS_Head.lVer);
|
||
if ( m_MMS_Head.lVer == MOBSET_MMS_VER_2 && m_MMS_Head.lSize == m_Mms.lmmSize && m_MMS_Head.lZCount>=0 && m_MMS_Head.lZCount<=MOBSET_MMS_MAX_Z ) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>
|
||
{
|
||
for ( int i=0 ; i<m_MMS_Head.lZCount ; i++ )
|
||
{
|
||
memcpy(&m_MMS_Z[i] , p , sizeof(MMS_Z_2));p=p+sizeof(MMS_Z_2);
|
||
if ( m_MMS_Z[i].lVer == MOBSET_MMS_VER_2 ) //<2F>ж<EFBFBD>ͷ<EFBFBD>Ǻϸ<C7BA>
|
||
{
|
||
//<2F>ָ<EFBFBD>3gp
|
||
if ( m_MMS_Z[i].l3gpSize>0 )
|
||
{
|
||
m_MMS_Z[i].p3gp = p;
|
||
p=p+m_MMS_Z[i].l3gpSize;
|
||
}
|
||
//<2F>ָ<EFBFBD>bmp
|
||
if ( m_MMS_Z[i].lBmpSize>0 )
|
||
{
|
||
m_MMS_Z[i].pBmp = p;
|
||
p=p+m_MMS_Z[i].lBmpSize;
|
||
}
|
||
//<2F>ָ<EFBFBD>midi
|
||
if ( m_MMS_Z[i].lMidiSize>0 )
|
||
{
|
||
m_MMS_Z[i].pMidi = p;
|
||
p=p+m_MMS_Z[i].lMidiSize;
|
||
}
|
||
//<2F>ָ<EFBFBD>txt
|
||
if ( m_MMS_Z[i].lTxtSize>0 )
|
||
{
|
||
m_MMS_Z[i].pTxt = (WCHAR*)p;
|
||
p=p+m_MMS_Z[i].lTxtSize;
|
||
}
|
||
lmmSizeCount = lmmSizeCount+m_MMS_Z[i].l3gpSize+m_MMS_Z[i].lBmpSize+m_MMS_Z[i].lMidiSize+m_MMS_Z[i].lTxtSize;
|
||
}
|
||
else
|
||
{
|
||
bRead = false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if ( bRead && lmmSizeCount>0 && lmmSizeCount == m_MMS_Head.lSize)
|
||
{
|
||
bRead = true;
|
||
}
|
||
else
|
||
{
|
||
bRead =false;
|
||
}
|
||
|
||
return bRead;
|
||
|
||
}
|
||
|
||
BOOL DLG_CheckUp_Mms_See::Mms_Showmm()
|
||
{
|
||
CStringW strHtml;
|
||
strHtml=L"<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title><3E><><EFBFBD>ײ<EFBFBD><D7B2>ű༭</title></head><body scroll='no' leftmargin='0' topmargin='0' >";
|
||
//strHtmlHead=L"<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title><3E><><EFBFBD>ײ<EFBFBD><D7B2>ű༭</title></head><body scroll='no' leftmargin='1' topmargin='0' style=\"border-width=0; border-style:none;%s\" > ";
|
||
if ( !m_bMmsOK || (m_MMS_Z[m_MMS_CurZ].l3gpSize<=0 && m_MMS_Z[m_MMS_CurZ].lBmpSize<=0 && m_MMS_Z[m_MMS_CurZ].lMidiSize<=0 && m_MMS_Z[m_MMS_CurZ].lTxtSize<=0) )
|
||
{
|
||
strHtml+=L"<p align=\"left\"><H3><br><3E><>֡<EFBFBD>հף<D5B0><D7A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><br></H3></p>";
|
||
}
|
||
else
|
||
{
|
||
CString str;
|
||
CString strFileName;
|
||
CStringW strW;
|
||
CStringW strHtmlShow;
|
||
|
||
TCHAR szPath[512]={0};
|
||
m_pMainFrame->GetCurrentPath(szPath);
|
||
_tcscat(szPath , _T("mms") );
|
||
::CreateDirectory(szPath , NULL ); //<2F><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||
Mms_DeleteDirectory(szPath); //<2F><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ɾ<EFBFBD><C9BE>
|
||
|
||
if ( m_MMS_Z[m_MMS_CurZ].pBmp && m_MMS_Z[m_MMS_CurZ].lBmpSize>0 )
|
||
{
|
||
//<2F><><EFBFBD><EFBFBD>ͼƬ<CDBC>ļ<EFBFBD>
|
||
strFileName.Format(_T("%s\\%s") , szPath , m_MMS_Z[m_MMS_CurZ].szBmpFileName );
|
||
CFile file;
|
||
if ( file.Open(strFileName , CFile::modeCreate|CFile::modeWrite) )
|
||
{
|
||
file.Write(m_MMS_Z[m_MMS_CurZ].pBmp , m_MMS_Z[m_MMS_CurZ].lBmpSize );
|
||
file.Close();
|
||
//<2F><><EFBFBD><EFBFBD>htmlָ<6C><D6B8>
|
||
#ifdef _UNICODE
|
||
strHtmlShow = strFileName;
|
||
#else
|
||
strHtmlShow = CA2W(strFileName);
|
||
#endif
|
||
strW.Format(L"<p align=\"center\"><img src='%s' align=\"middle\"></img></p>" , strHtmlShow );
|
||
strHtml += strW;
|
||
}
|
||
}
|
||
|
||
if ( m_MMS_Z[m_MMS_CurZ].pMidi && m_MMS_Z[m_MMS_CurZ].lMidiSize>0 )
|
||
{
|
||
//<2F><><EFBFBD><EFBFBD>ͼƬ<CDBC>ļ<EFBFBD>
|
||
strFileName.Format(_T("%s\\%s") , szPath , m_MMS_Z[m_MMS_CurZ].szMidiFileName );
|
||
CFile file;
|
||
if ( file.Open(strFileName , CFile::modeCreate|CFile::modeWrite) )
|
||
{
|
||
file.Write(m_MMS_Z[m_MMS_CurZ].pMidi , m_MMS_Z[m_MMS_CurZ].lMidiSize );
|
||
file.Close();
|
||
#ifdef _UNICODE
|
||
strHtmlShow = strFileName;
|
||
#else
|
||
strHtmlShow = CA2W(strFileName);
|
||
#endif
|
||
|
||
strW.Format(L"<p align=\"left\"><H3><br><3E><>֡<EFBFBD><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><br></H3></p>" );
|
||
strHtml += strW;
|
||
}
|
||
}
|
||
|
||
if ( m_MMS_Z[m_MMS_CurZ].pTxt && m_MMS_Z[m_MMS_CurZ].lTxtSize>0 )
|
||
{
|
||
strHtmlShow = L"";
|
||
if ( m_MMS_Head.lVer == MOBSET_MMS_VER_1)
|
||
strHtmlShow = CA2W((char*)m_MMS_Z[m_MMS_CurZ].pTxt);
|
||
if ( m_MMS_Head.lVer == MOBSET_MMS_VER_2)
|
||
strHtmlShow = (WCHAR*)m_MMS_Z[m_MMS_CurZ].pTxt;
|
||
strW.Format(L"<pre style=\"word-break: break-all; word-wrap:break-word;\">%s</pre>" , strHtmlShow );
|
||
strHtml += strW;
|
||
}
|
||
}
|
||
|
||
strHtml+= L"</body></html>";
|
||
|
||
|
||
CStringA strHtml2;
|
||
#ifdef _UNICODE
|
||
strHtml2=this->ConvertUnicodeToUtf8(strHtml);
|
||
#else
|
||
strHtml2 = strHtml;
|
||
//ConvertGBKToUtf8(strHtml2);
|
||
#endif;
|
||
|
||
/*
|
||
#ifdef _DEBUG
|
||
CFile file(_T("d:\\abc.html") , CFile::modeCreate|CFile::modeReadWrite);
|
||
file.Write(strHtml2,strHtml2.GetLength());
|
||
file.Close();
|
||
#endif
|
||
*/
|
||
|
||
IHTMLDocument2* pDoc = (IHTMLDocument2*)m_Html.GetHtmlDocument();
|
||
if ( !pDoc )
|
||
{
|
||
return false;
|
||
}
|
||
|
||
HGLOBAL hMem;
|
||
LPSTREAM pStream;
|
||
IPersistStreamInit *pPersistStream;
|
||
hMem = ::GlobalAlloc(GPTR, (strHtml2.GetLength() + 1));
|
||
strcpy((char *)hMem, strHtml2);
|
||
HRESULT hr = ::CreateStreamOnHGlobal(hMem, TRUE, &pStream);
|
||
if(FAILED(hr))
|
||
{
|
||
::GlobalFree(hMem);
|
||
return false;
|
||
}
|
||
hr = pDoc->QueryInterface(IID_IPersistStreamInit, (void**)&pPersistStream);
|
||
pDoc->Release();
|
||
if(FAILED(hr))
|
||
{
|
||
::GlobalFree(hMem); //<2F><><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>,˵<><CBB5>GetHtmlDocument()<29><><EFBFBD>صĶ<D8B5><C4B6><EFBFBD>û<EFBFBD><C3BB>IID_IPersistStreamInit<69>ӿ<EFBFBD>,û<><C3BB><EFBFBD><EFBFBD>ѽ!
|
||
return false;
|
||
}
|
||
if(pPersistStream == NULL)
|
||
{
|
||
pStream->Release();
|
||
return false;
|
||
}
|
||
hr = pPersistStream->InitNew();
|
||
hr = pPersistStream->Load(pStream);
|
||
|
||
hr = pPersistStream->Release();
|
||
pStream->Release();
|
||
|
||
/*
|
||
CStringA strHtml2;
|
||
strHtml2=this->ConvertUnicodeToUtf8(strHtml);
|
||
|
||
IHTMLDocument2* pDoc = (IHTMLDocument2*)m_Html.GetHtmlDocument();
|
||
if ( !pDoc )
|
||
{
|
||
return false;
|
||
}
|
||
|
||
HGLOBAL hMem;
|
||
LPSTREAM pStream;
|
||
IPersistStreamInit *pPersistStream;
|
||
hMem = ::GlobalAlloc(GPTR, (strHtml.GetLength() + 1) * sizeof WCHAR);
|
||
strcpy((char *)hMem, strHtml2);
|
||
HRESULT hr = ::CreateStreamOnHGlobal(hMem, TRUE, &pStream);
|
||
if(FAILED(hr))
|
||
{
|
||
::GlobalFree(hMem);
|
||
return false;
|
||
}
|
||
hr = pDoc->QueryInterface(IID_IPersistStreamInit, (void**)&pPersistStream);
|
||
pDoc->Release();
|
||
if(FAILED(hr))
|
||
{
|
||
::GlobalFree(hMem); //<2F><><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>,˵<><CBB5>GetHtmlDocument()<29><><EFBFBD>صĶ<D8B5><C4B6><EFBFBD>û<EFBFBD><C3BB>IID_IPersistStreamInit<69>ӿ<EFBFBD>,û<><C3BB><EFBFBD><EFBFBD>ѽ!
|
||
return false;
|
||
}
|
||
if(pPersistStream == NULL)
|
||
{
|
||
pStream->Release();
|
||
return false;
|
||
}
|
||
hr = pPersistStream->InitNew();
|
||
hr = pPersistStream->Load(pStream);
|
||
|
||
hr = pPersistStream->Release();
|
||
pStream->Release();
|
||
*/
|
||
Mms_Showscroll();
|
||
|
||
ShowZMsg();
|
||
|
||
return true;
|
||
}
|
||
|
||
BOOL DLG_CheckUp_Mms_See::Mms_DeleteDirectory(CString sDirName)
|
||
{
|
||
CFileFind tempFind;
|
||
TCHAR sTempFileFind[512] ;
|
||
|
||
_stprintf(sTempFileFind,_T("%s\\*.*"),sDirName);
|
||
BOOL IsFinded = tempFind.FindFile(sTempFileFind);
|
||
while (IsFinded)
|
||
{
|
||
IsFinded = tempFind.FindNextFile();
|
||
|
||
if (!tempFind.IsDots())
|
||
{
|
||
TCHAR sFoundFileName[512];
|
||
_tcscpy(sFoundFileName,tempFind.GetFileName().GetBuffer(200));
|
||
|
||
if (tempFind.IsDirectory())
|
||
{
|
||
TCHAR sTempDir[512];
|
||
_stprintf(sTempDir,_T("%s\\%s"),sDirName,sFoundFileName);
|
||
Mms_DeleteDirectory(sTempDir);
|
||
}
|
||
else
|
||
{
|
||
TCHAR sTempFileName[512];
|
||
_stprintf(sTempFileName,_T("%s\\%s"),sDirName,sFoundFileName);
|
||
DeleteFile(sTempFileName);
|
||
}
|
||
}
|
||
}
|
||
tempFind.Close();
|
||
//if(!RemoveDirectory(sDirName))
|
||
//{
|
||
// return FALSE;
|
||
//}
|
||
return TRUE;
|
||
}
|
||
|
||
BOOL DLG_CheckUp_Mms_See::Mms_Showscroll()
|
||
{
|
||
HRESULT hr;
|
||
IHTMLDocument2* pDoc = (IHTMLDocument2*)m_Html.GetHtmlDocument();
|
||
if ( !pDoc )
|
||
{
|
||
return false;
|
||
}
|
||
/*
|
||
IHTMLDocument3 *piDoc3 = NULL;
|
||
IHTMLElement *piDocElement = NULL;
|
||
IHTMLElement2 *piDocElement2 = NULL;
|
||
pDoc->QueryInterface(__uuidof(IHTMLDocument3), (void**) &piDoc3);
|
||
piDoc3->get_documentElement(&piDocElement);
|
||
piDocElement->QueryInterface(__uuidof(IHTMLElement2), (void**) &piDocElement2);
|
||
long l=0;
|
||
piDocElement2->get_clientHeight(&l);
|
||
*/
|
||
|
||
IHTMLElement *phtmlElement = NULL;
|
||
pDoc->get_body(&phtmlElement);
|
||
pDoc->Release();
|
||
if ( !phtmlElement )
|
||
{
|
||
return false;
|
||
}
|
||
IHTMLElement2 *phtmlElement2 = NULL;
|
||
hr = phtmlElement->QueryInterface(IID_IHTMLElement2, (void**)&phtmlElement2);
|
||
if(FAILED(hr))
|
||
{
|
||
phtmlElement->Release();
|
||
return false;
|
||
}
|
||
if ( !phtmlElement2)
|
||
{
|
||
phtmlElement->Release();
|
||
return false;
|
||
}
|
||
|
||
long lHeight=0;
|
||
long lHeight4=0;
|
||
phtmlElement2->get_clientHeight(&lHeight);
|
||
phtmlElement2->get_scrollHeight(&lHeight4);
|
||
phtmlElement2->Release();
|
||
/*
|
||
long lHeight2=0;
|
||
CRect rect;
|
||
m_Html.GetWindowRect(&rect);
|
||
lHeight2=rect.Height();
|
||
*/
|
||
|
||
|
||
IHTMLBodyElement *phtmlbody = NULL;
|
||
phtmlElement->QueryInterface(IID_IHTMLBodyElement, (void**)&phtmlbody);
|
||
if(phtmlbody != NULL)
|
||
{
|
||
if (lHeight<lHeight4)
|
||
phtmlbody->put_scroll(L"yes");
|
||
else
|
||
phtmlbody->put_scroll(L"no");
|
||
phtmlbody->Release();
|
||
phtmlElement->Release();
|
||
}
|
||
phtmlElement->Release();
|
||
|
||
return true;
|
||
}
|
||
|
||
void DLG_CheckUp_Mms_See::OnCheckupseeUp()
|
||
{
|
||
if ( m_bMmsOK )
|
||
{
|
||
if ( m_MMS_CurZ-1>=0 )
|
||
{
|
||
m_MMS_CurZ=m_MMS_CurZ-1;
|
||
this->Mms_Showmm();
|
||
}
|
||
}
|
||
}
|
||
|
||
void DLG_CheckUp_Mms_See::OnCheckupseeDown()
|
||
{
|
||
if ( m_bMmsOK )
|
||
{
|
||
if ( m_MMS_CurZ+1<m_MMS_Head.lZCount )
|
||
{
|
||
m_MMS_CurZ=m_MMS_CurZ+1;
|
||
this->Mms_Showmm();
|
||
}
|
||
}
|
||
}
|
||
|
||
void DLG_CheckUp_Mms_See::ShowZMsg()
|
||
{
|
||
CString str;
|
||
if ( m_bMmsOK )
|
||
str.Format(_T("<EFBFBD><EFBFBD>:%.2fk , %d/%d") , (float)m_MMS_Head.lSize/1024.0f , m_MMS_CurZ+1 , m_MMS_Head.lZCount );
|
||
|
||
m_S_Msg.SetWindowText(str);
|
||
|
||
}
|
||
|
||
|
||
CStringA DLG_CheckUp_Mms_See::ConvertUnicodeToUtf8(CStringW &strUni)
|
||
{
|
||
int len = WideCharToMultiByte(CP_UTF8, 0, strUni, -1, NULL, 0, NULL, NULL);
|
||
char *szUtf8=new char[len + 1];
|
||
memset(szUtf8, 0, len + 1);
|
||
WideCharToMultiByte (CP_UTF8, 0, strUni, -1, szUtf8, len, NULL,NULL);
|
||
|
||
CStringA strUtf8 = szUtf8;
|
||
delete[] szUtf8;
|
||
return strUtf8;
|
||
}
|
||
|
||
void DLG_CheckUp_Mms_See::OnBnClickedCheckupseeCopytxt()
|
||
{
|
||
if ( m_MMS_CurZ <0 || m_MMS_CurZ>MOBSET_MMS_MAX_Z || !m_MMS_Z[m_MMS_CurZ].pTxt || m_MMS_Z[m_MMS_CurZ].lTxtSize<=0 )
|
||
{
|
||
MessageBox(_T("û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>") , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
||
return ;
|
||
}
|
||
if ( m_MMS_Z[m_MMS_CurZ].pTxt && m_MMS_Z[m_MMS_CurZ].lTxtSize>0 )
|
||
{
|
||
CStringW strHtmlShow = L"";
|
||
if ( m_MMS_Head.lVer == MOBSET_MMS_VER_1)
|
||
strHtmlShow = CA2W((char*)m_MMS_Z[m_MMS_CurZ].pTxt);
|
||
if ( m_MMS_Head.lVer == MOBSET_MMS_VER_2)
|
||
strHtmlShow = (WCHAR*)m_MMS_Z[m_MMS_CurZ].pTxt;
|
||
|
||
HGLOBAL hglbCopy;
|
||
WCHAR * lptstrCopy;
|
||
if (!OpenClipboard())
|
||
return ;
|
||
EmptyClipboard();
|
||
|
||
hglbCopy = GlobalAlloc(GMEM_MOVEABLE, strHtmlShow.GetLength()*sizeof(WCHAR)+2);
|
||
if (hglbCopy == NULL)
|
||
{
|
||
CloseClipboard();
|
||
return ;
|
||
}
|
||
lptstrCopy = (WCHAR *)GlobalLock(hglbCopy);
|
||
wcscpy(lptstrCopy,strHtmlShow);
|
||
GlobalUnlock(hglbCopy);
|
||
SetClipboardData(CF_UNICODETEXT, hglbCopy);
|
||
CloseClipboard();
|
||
}
|
||
}
|
||
|
||
|
||
void DLG_CheckUp_Mms_See::OnBnClickedCheckupseeSavebmp()
|
||
{
|
||
CString str;
|
||
if ( m_MMS_CurZ <0 || m_MMS_CurZ>MOBSET_MMS_MAX_Z || !m_MMS_Z[m_MMS_CurZ].pBmp || m_MMS_Z[m_MMS_CurZ].lBmpSize<=0 )
|
||
{
|
||
MessageBox(_T("û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>棡") , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
||
return ;
|
||
}
|
||
if ( m_MMS_Z[m_MMS_CurZ].pBmp && m_MMS_Z[m_MMS_CurZ].lBmpSize>0 )
|
||
{
|
||
|
||
#define FILE_FILTER_TEXT \
|
||
TEXT("<22><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD> (*.*)\0*.*;\0\0")
|
||
|
||
TCHAR szFile[ 256 ];
|
||
TCHAR szFileB[ 256 ];
|
||
*szFileB = NULL;
|
||
#ifdef _UNICODE
|
||
_tcscpy( szFile , m_MMS_Z[m_MMS_CurZ].szBmpFileName );
|
||
#else
|
||
_tcscpy( szFile , CW2A(m_MMS_Z[m_MMS_CurZ].szBmpFileName) );
|
||
#endif
|
||
|
||
OPENFILENAME sOpen;
|
||
sOpen.lStructSize = sizeof( sOpen );
|
||
sOpen.hwndOwner = this->m_hWnd ;
|
||
sOpen.Flags = OFN_EXPLORER|OFN_OVERWRITEPROMPT|OFN_HIDEREADONLY;
|
||
sOpen.lpstrFilter = FILE_FILTER_TEXT;
|
||
sOpen.lpstrDefExt = _T("");
|
||
sOpen.lpstrCustomFilter = NULL;
|
||
sOpen.nMaxCustFilter = 0;
|
||
sOpen.lpstrFile = szFile;
|
||
sOpen.nMaxFile = sizeof( szFile );
|
||
sOpen.lpstrFileTitle = szFileB;
|
||
sOpen.nMaxFileTitle = sizeof( szFileB );
|
||
sOpen.lpstrInitialDir = NULL;
|
||
sOpen.lpstrTitle = _T("ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>");
|
||
if ( ::GetSaveFileName( &sOpen ) )
|
||
{
|
||
CString strFileName = sOpen.lpstrFile;
|
||
CFile file;
|
||
|
||
if ( file.Open(strFileName,CFile::modeCreate|CFile::modeReadWrite) )
|
||
{
|
||
file.Write(m_MMS_Z[m_MMS_CurZ].pBmp , m_MMS_Z[m_MMS_CurZ].lBmpSize);
|
||
}
|
||
else
|
||
{
|
||
str.Format(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD><EFBFBD>:%s") , strFileName );
|
||
MessageBox(str , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
|
||
void DLG_CheckUp_Mms_See::OnBnClickedCheckupseeSavemidi()
|
||
{
|
||
CString str;
|
||
if ( m_MMS_CurZ <0 || m_MMS_CurZ>MOBSET_MMS_MAX_Z || !m_MMS_Z[m_MMS_CurZ].pMidi || m_MMS_Z[m_MMS_CurZ].lMidiSize<=0 )
|
||
{
|
||
MessageBox(_T("û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>棡") , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
||
return ;
|
||
}
|
||
if ( m_MMS_Z[m_MMS_CurZ].pMidi && m_MMS_Z[m_MMS_CurZ].lMidiSize>0 )
|
||
{
|
||
|
||
#define FILE_FILTER_TEXT \
|
||
TEXT("<22><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD> (*.*)\0*.*;\0\0")
|
||
|
||
TCHAR szFile[ 256 ];
|
||
TCHAR szFileB[ 256 ];
|
||
*szFileB = NULL;
|
||
#ifdef _UNICODE
|
||
_tcscpy( szFile , m_MMS_Z[m_MMS_CurZ].szMidiFileName );
|
||
#else
|
||
_tcscpy( szFile , CW2A(m_MMS_Z[m_MMS_CurZ].szMidiFileName) );
|
||
#endif
|
||
|
||
OPENFILENAME sOpen;
|
||
sOpen.lStructSize = sizeof( sOpen );
|
||
sOpen.hwndOwner = this->m_hWnd ;
|
||
sOpen.Flags = OFN_EXPLORER|OFN_OVERWRITEPROMPT|OFN_HIDEREADONLY;
|
||
sOpen.lpstrFilter = FILE_FILTER_TEXT;
|
||
sOpen.lpstrDefExt = _T("");
|
||
sOpen.lpstrCustomFilter = NULL;
|
||
sOpen.nMaxCustFilter = 0;
|
||
sOpen.lpstrFile = szFile;
|
||
sOpen.nMaxFile = sizeof( szFile );
|
||
sOpen.lpstrFileTitle = szFileB;
|
||
sOpen.nMaxFileTitle = sizeof( szFileB );
|
||
sOpen.lpstrInitialDir = NULL;
|
||
sOpen.lpstrTitle = _T("ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>");
|
||
if ( ::GetSaveFileName( &sOpen ) )
|
||
{
|
||
CString strFileName = sOpen.lpstrFile;
|
||
CFile file;
|
||
|
||
if ( file.Open(strFileName,CFile::modeCreate|CFile::modeReadWrite) )
|
||
{
|
||
file.Write(m_MMS_Z[m_MMS_CurZ].pMidi , m_MMS_Z[m_MMS_CurZ].lMidiSize);
|
||
}
|
||
else
|
||
{
|
||
str.Format(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD><EFBFBD>:%s") , strFileName );
|
||
MessageBox(str , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
|
||
void DLG_CheckUp_Mms_See::OnBnClickedCheckupseeSavemms()
|
||
{
|
||
if ( !m_pMmsBuf || m_lMmsSize<=0 )
|
||
{
|
||
MessageBox(_T("û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>棡") , _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
||
return ;
|
||
}
|
||
|
||
#define FILE_FILTER_TEXT \
|
||
TEXT("<22><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD> (*.mms)\0*.mms\0")\
|
||
TEXT("<22><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD> (*.*)\0*.*;\0\0")
|
||
|
||
TCHAR szFile[ 256 ];
|
||
TCHAR szFileB[ 256 ];
|
||
*szFileB = NULL;
|
||
_stprintf( szFile , _T("*.mms") );
|
||
|
||
|
||
OPENFILENAME sOpen;
|
||
sOpen.lStructSize = sizeof( sOpen );
|
||
sOpen.hwndOwner = this->m_hWnd ;
|
||
sOpen.Flags = OFN_EXPLORER|OFN_OVERWRITEPROMPT|OFN_HIDEREADONLY;
|
||
sOpen.lpstrFilter = FILE_FILTER_TEXT;
|
||
sOpen.lpstrDefExt = _T("mms");
|
||
sOpen.lpstrCustomFilter = NULL;
|
||
sOpen.nMaxCustFilter = 0;
|
||
sOpen.lpstrFile = szFile;
|
||
sOpen.nMaxFile = sizeof( szFile );
|
||
sOpen.lpstrFileTitle = szFileB;
|
||
sOpen.nMaxFileTitle = sizeof( szFileB );
|
||
sOpen.lpstrInitialDir = NULL;
|
||
sOpen.lpstrTitle = _T("ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>");
|
||
if ( !::GetSaveFileName( &sOpen ) )
|
||
{
|
||
return ;
|
||
}
|
||
CString str;
|
||
CString strFileName=sOpen.lpstrFile;
|
||
CFile file;
|
||
if ( !file.Open(strFileName,CFile::modeCreate|CFile::modeReadWrite) )
|
||
{
|
||
str.Format(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>%s"),strFileName);
|
||
MessageBox(str,_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") , MB_ICONWARNING );
|
||
return ;
|
||
}
|
||
file.Write(m_pMmsBuf,m_lMmsSize);
|
||
file.Close();
|
||
}
|