Jiangsheng的CSDN Digest (Dec 2005)[4]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:


我有一个链接
http://mtgroup.ict.ac.cn/~zhp/ICTCLAS.htm

这个链接里面有一个输入框,看不到的朋友我把代码也贴上来。

<body background="ICTCLAS/images/blegtext.gif" bgcolor="#CCCCCC" text="#000000" link="#993300" vlink="#0000FF" alink="#FF9900">

<FORM action="/ictclas-cgi/ictclas_c" method=post>
<P>输入句子段落:
<P><TEXTAREA name=address rows=6 cols=101>张华平于1978年3月出生于江西省波阳县。</TEXTAREA>
<P><INPUT type=submit value=切分标注 name=submit1> <INPUT type=reset value=重置>
</FORM>

</body>

可以看到这里面有关textarea ,还有一个叫做“切分标注的”button。我要做的是模拟在textarea里面输入数据,然后点击“input”button,然后接收到服务器端传回来的结果。
不知道这个事情我能不能用什么语言来做。什么语言都可以。


用Win32::OLE创建一个Internet.Application就可以
#launch an Internet Explorer window and search for ACC map
#for more information about automating Internet Explorer
#see my article http://www.codeproject.com/shell/AutomateShellWindow.asp

use Win32::OLE qw(EVENTS);
my $URL = "http://maps.google.com/";
my $IE = Win32::OLE->new("InternetExplorer.Application")
|| die "Could not start Internet Explorer.Application\n";
Win32::OLE->WithEvents($IE,\&Event,"DWebBrowserEvents2");
$IE->{visible} = 1; #invisible by default
$IE->Navigate($URL);
Win32::OLE->MessageLoop();
sub Event {
my ($Obj,$Event,@Args) = @_;
print "Here is the Event: $Event\n";
if ($Event eq "DocumentComplete") {
my $IEObject = shift @Args;
print "Sender: $IEObject\n";
print "URL: " . $IEObject->Document->URL . "\n";
if($IEObject->Document->URL eq $URL)
{
SetEditBox($IEObject->Document,"q","1212 Rio Grande St., Austin, TX 78701");
ClickButton($IEObject->Document,"submitq");
}
}
if ($Event eq "OnQuit") {
print "User Closed Internet Explorer, quiting";
#Win32::OLE->WithEvents($IE,\&Event,"DWebBrowserEvents2");
undef $IE;
Win32::OLE->QuitMessageLoop();
exit(0);
}
}
sub SetEditBox {
my ($IEDocument,$name, $value) = @_;
my $forms = $IEDocument->forms;
for (my $i = 0; $i < $forms->length; $i++) {
my $form = $forms->item($i);
if (defined($form->elements($name))) {
$form->elements($name)->{value} = $value;
}
return;
}
}
sub ClickButton{
my ($IEDocument,$name) = @_;
my $forms = $IEDocument->forms;
for (my $i = 0; $i < $forms->length; $i++) {
my $form = $forms->item($i);
if (defined($form->elements($name))) {
$form->elements($name)->click;
}
return;
}
}


VC.NET无法启动调试:计算机调试管理服务器被禁用?怎么办?? (.NET技术 VC.NET )


有些网络管理员为了安全起见,禁止一般用户调试程序。你可以使用WinDbg( Debug Tools For Windows)来调试看看


Visual C++ 2005 Express 能否编译出不依赖.net平台的程序 (C/C++ 工具平台和程序库 )


Download the Windows Platform SDK and create a windows or console application.


请教一个C++.NET中定义消息映射函数的问题 (.NET技术 VC.NET)


用MSVisual C++.NET新建一个MFC Application工程.
1、在框架程序的头文件(比如MainFrm.h)中有这样的定义:
#define WM_MYPNP (WM_USER + 100)

//定义消息映射函数:
afx_msg void OnPtoP();

2、然后在程序文件(比如MainFrm.cpp)中这样定义:
BEGIN_MESSAGE_MAP(CMainFrame,CFrameWnd)
ON_MESSAGE(WM_MYPNP ,OnPtoP)
END_MESSAGE_MAP()

void CMainFrame:: OnPtoP()
{
}


在C++6.0是可以的,但在C++.NET(2003)中不行。
编译通不过。
erre:C2440 'static_cast' connot convert from 'void (__thiscall CMainFrame::*)(void)' to ''LRESULT(__thiscall CWnd::*)(PARAM,LPARAM)


afx_msg LRESULT OnPtoP(PARAM,LPARAM);
Visual C++ 6.0 does not check the function signature, and VC2003 uses static_cast to check it.


怎样使DLL中的窗体或对话框PreTranslateMessage能有用呢?(VC/MFC 进程/线程/DLL)


一般情况下DLL 的窗体或对话框,是不能响应这个PreTranslateMessage函数的,
而被主程序窗口响应了。
怎么样使这个函数在DLL的窗体中也能响应呢?有效呢?
我主要是想在DLL的窗体中用工具提示类?
m_ToolTipCtrl.RelayEvent(pMsg);
return CDialog::PreTranslateMessage(pMsg);


PreTranslateMessage is called by a MFC message pump. If the message pump is not a MFC one, your PreTranslateMessage won't be called. Export a PreTranslateMessage function from your DLL and call it in the message pump.

BOOL CXXXDlg::PreTranslateMessage(MSG* pMsg)
{
    // TODO: Add your specialized code here and/or call the base class
    if(m_pDLLExportedPreTranslateMessage(pMsg))
        return true;
    return CDialog::PreTranslateMessage(pMsg);
}

Reference
http://support.microsoft.com/kb/q140850/

本文关键:Jiangsheng的CSDN Digest (Dec 2005)
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top