用spy++获取class名为Internet Explorer_Server,然后我就无能为力了,怎样获得网页中文本框的句柄呢???比如说现在的网页为google
解决方案 »
- C#中的 ListView是如何记录数据状态的
- 程序中使用WORD,客户机上必需装office吗?
- Allchina.cn招聘C#.net程序员(北京地区)
- 菜鸟问一个简单的字符串问题!!~! 请大家帮帮忙~!
- 如何得到一个控件相对于屏幕左上角的坐标。
- c#群 12028576
- 呕血,新手上路,跪求高人!
- PictureBox的Margin问题
- ---- 哪儿有vs.net英文版下 == 哪儿有vs.net英文版买(如同csdn上便宜的那种)----
- 哎~~问题又来了 还是datagrid
- ComboBox.SelectedValue传过来的值不对是什么原因????????????????????????????
- 怎样在datagrid中显示刚编辑过的数据???????????????
http://blogs.msdn.com/rfarber/archive/2004/10/12/240943.aspx
# re: DrawToDC @ Tuesday, October 12, 2004 5:05 PM
I tried this real quick and it works. I threw together a form with an IE control and a panel. There is an issue with import of the MSHTML interface so just redeclare it locally and you will have no problems. If render is null, you may have a frame to deal with.using System;
using System.Drawing;
using System.Runtime.InteropServices;
using SHDocVw;
using mshtml;namespace ScreenGrab
{
[
Guid("3050f669-98b5-11cf-bb82-00aa00bdce0b"),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown),
ComVisible(true),
ComImport
]
interface IHTMLElementRender
{
void DrawToDC([In] IntPtr hDC);
void SetDocumentPrinter([In, MarshalAs(UnmanagedType.BStr)] string bstrPrinterName, [In] IntPtr hDC);
};public class IEElementCapture
{
private IWebBrowser2 webBrowser = null;public IEElementCapture(IWebBrowser2 webBrowser)
{
this.webBrowser = webBrowser;
}public bool Capture(ref Graphics g)
{
if ( null == webBrowser )
{
return false;
}IHTMLDocument2 htmlDocument = (IHTMLDocument2) webBrowser.Document;
if ( null != htmlDocument )
{
IHTMLElement bodyElement = (IHTMLElement) htmlDocument.body;
if ( null != bodyElement )
{
IHTMLElementRender render = (IHTMLElementRender) bodyElement;
if ( null != render )
{
IntPtr memDC = g.GetHdc();
render.DrawToDC(memDC);
return true;
}
}
}return false;
}
}
}Darron