📄 formdialog.cpp
字号:
// FormDialog.cpp : 实现文件
//
/*
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
文件:FormDialog.cpp
版权:FireBall Software Workroom
声明:本源程序的版权受《中华人民共和国著作权法》以及其
它相关法律和条约的保护。任何有机会得到本源程序的
个人和机构,未经作者明确授权,不得将本源程序用于
任何商业目的(直接的或间接的)。对于非商业目的的使
用 (包括复制、传播、编译和修改), 原则上没有特别
的限制条款,但请在相关文档中说明其来源,并尊重原
作者的署名权。
编写:丁称林(Besiding) 2004.10.27
联络:Tel:(0591)3703333-7806 E_mail:besiding@etang.com
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
#include "stdafx.h"
#include "mydhtml.h"
#include "FormDialog.h"
#include ".\formdialog.h"
// CFormDialog 对话框
IMPLEMENT_DYNAMIC(CFormDialog, CDialog)
CFormDialog::CFormDialog(CWnd* pParent /*=NULL*/)
: CDialog(CFormDialog::IDD, pParent)
{
m_bNavigated=FALSE;
}
CFormDialog::~CFormDialog()
{
}
void CFormDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_EXPLORER1, m_Explorer);
}
BEGIN_MESSAGE_MAP(CFormDialog, CDialog)
END_MESSAGE_MAP()
BOOL CFormDialog::OnInitDialog()
{
CDialog::OnInitDialog();
TCHAR strURL[512];
// VARIANT varArgs;
HINSTANCE hInstance = AfxGetResourceHandle();
ASSERT(hInstance != NULL);
LPTSTR lpszModule = new TCHAR[_MAX_PATH];
// OLECHAR bstr[MAX_PATH*2];
if (GetModuleFileName(hInstance, lpszModule, _MAX_PATH))
{
wsprintf(strURL, _T("res://%s/%d?产品ID号;用户名;公司名称;应用程序版本号"), lpszModule, IDR_HTML_FORM);
}
delete []lpszModule;
// strURL=strURL+"产品ID号;用户名;公司名称;应用程序版本号";
// varArgs.vt = VT_BSTR;
// LocalToBSTR(bstr,strURL,MAX_PATH*2);
// varArgs.bstrVal = bstr;
// VariantClear(&varArgs);
m_Explorer.Navigate(strURL, NULL, NULL,NULL,NULL);
m_bNavigated=TRUE;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
// CFormDialog 消息处理程序
BEGIN_EVENTSINK_MAP(CFormDialog, CDialog)
ON_EVENT(CFormDialog, IDC_EXPLORER1, 250, BeforeNavigate2Explorer1, VTS_DISPATCH VTS_PVARIANT VTS_PVARIANT VTS_PVARIANT VTS_PVARIANT VTS_PVARIANT VTS_PBOOL)
END_EVENTSINK_MAP()
void CFormDialog::BeforeNavigate2Explorer1(LPDISPATCH pDisp, VARIANT* URL, VARIANT* Flags, VARIANT* TargetFrameName, VARIANT* PostedData, VARIANT* Headers, BOOL* Cancel)
{
CString strMessage, strBytes;
strMessage = _T("");
if(!m_bNavigated)
return;
// Get general info from the submitted form
// Get the POST data
// This is where this sample gets semi-cool
// strBytes = _T("\n\nPosted Bytes :\n\n");
// FORM的返回值在PostedData里,用户可以分析它。
/* CByteArray* baPostedData=(CByteArray*)&PostedData;
if (baPostedData->GetSize())
{
// This is a kludgy copy, but you get the idea
for(int i = 0;i < baPostedData->GetSize();i++)
{
strBytes += (char)(*baPostedData)[i];
}
// Let's split the posted data into separate lines
// for the messagebox
CString Productid,UserName,CompanyName,AppVersion;
sscanf(strBytes,"Productid=%s&UserName=%s&CompanyName=%AppVersion=%s",
Productid,UserName,CompanyName,AppVersion);
// strBytes.Replace("&","\n");
}
*/
// Once the data is copied, we can do anything we
// want with it, but I'll just display the silly
// MessageBox
// baPostedData->bstrVal;
AfxMessageBox((strMessage + strBytes),MB_OK);
EndDialog(IDOK);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -