AxWebBrowser不在WinForm中 [英] AxWebBrowser not in WinForm

查看:78
本文介绍了AxWebBrowser不在WinForm中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我需要从我的程序中处理网站,但我不需要显示

网站内容..我只需要得到网页改变html中的内容

文件,然后继续前进或发回一些东西..

基本上与人们通常用IE做的几乎相同但是

没有窗口......

我以为使用AxWebBrowser实现更容易

ActiveX控件,但我不知道如何设置OCXState字段

如果我不在WinForm中创建对象。如果没有设置它,我会得到

InvalidActiveXStateException ...

所以我想我的问题是,如何使用AxWebBrowser控件而不用

WinForm还是有更好的方法来解决我的问题?

谢谢

D.

Hi everyone,
I need to work with web sites from my program but i don''t need to show
web site content.. I only need to get web page change something in html
document and either move on or send something back..
Basically pretty much the same what usually people would do with IE but
no windows...
I thought that it would be easier to implement using AxWebBrowser
ActiveX control, but I can''t figure out how to set that OCXState field
if I don''t create object within WinForm. If don''t set it , I get
InvalidActiveXStateException...
So I guess my question is, how to use AxWebBrowser control without
WinForm or maybe there is a better way to solve my problem?
Thanks
D.

推荐答案

假设您只是尝试获取给定站点的HTML代码,您可以使用HTTP协议执行

Get请求以获取页面上的HTML代码。 br />

" Djavdet" < DJ ***** @ yahoo.com>在消息中写道

news:11 ********************** @ c13g2000cwb.googlegr oups.com ...
Assuming you are only trying to get HTML code of a given site, you can do a
Get request using HTTP protocol to get the code of HTML on the page.

"Djavdet" <dj*****@yahoo.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
大家好,
我需要从我的程序中处理网站,但我不需要显示网站内容..我只需要在html中更改网页内容
文件,要么继续前进,要么发送回去......
基本上和人们通常会用IE做的几乎相同但是没有窗户......
我以为它会使用AxWebBrowser
ActiveX控件更容易实现,但如果我不在WinForm中创建对象,我无法弄清楚如何设置OCXState字段
。如果没有设置它,我会得到
InvalidActiveXStateException ...
所以我想我的问题是,如何在没有WinForm的情况下使用AxWebBrowser控件或者可能有更好的方法来解决我的问题问题?
谢谢
D。
Hi everyone,
I need to work with web sites from my program but i don''t need to show
web site content.. I only need to get web page change something in html
document and either move on or send something back..
Basically pretty much the same what usually people would do with IE but
no windows...
I thought that it would be easier to implement using AxWebBrowser
ActiveX control, but I can''t figure out how to set that OCXState field
if I don''t create object within WinForm. If don''t set it , I get
InvalidActiveXStateException...
So I guess my question is, how to use AxWebBrowser control without
WinForm or maybe there is a better way to solve my problem?
Thanks
D.



D,


我不确定你是什​​么意思---
D,

I am not sure what you mean by ---
我只需要在html
文档中更改网页,然后继续或发回一些东西..


但是,我最近在我的博客上发布了一个简短的代码片段 -
http://dotnetjunkies.com/WebLog/sahi.../06/42130.aspx

,它可以让你轻松检索URL并将其保存为MHT。而不是保存,

你可以从中获取一个字符串,并使用它。


那就是有非托管代码(使用互操作),但是还有其他

管理方式来实现这一目标。不幸的是,他们没有一个允许你将
保存为MHT,但你可能不需要这样做。


- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik


" Djavdet" < DJ ***** @ yahoo.com>在消息中写道

新闻:11 ********************** @ c13g2000cwb.googlegr oups.com ...大家好,<我需要从我的程序中处理网站,但我不需要显示网站内容..我只需要在html
文档中更改网页并移动或者送回来的东西..
基本上和人们通常会用IE做的几乎相同但是没有窗户......
我认为使用AxWebBrowser实现起来会更容易ActiveX控件,但如果我不在WinForm中创建对象,我无法弄清楚如何设置OCXState字段
。如果没有设置它,我会得到
InvalidActiveXStateException ...
所以我想我的问题是,如何在没有WinForm的情况下使用AxWebBrowser控件或者可能有更好的方法来解决我的问题问题?
谢谢
D。
I only need to get web page change something in html
document and either move on or send something back..
But, I recently posted a little short code snippet on my blog -
http://dotnetjunkies.com/WebLog/sahi.../06/42130.aspx
that lets you easily retreive a URL and save it as MHT. Instead of saving,
you could get a string out of it, and work with it.

That right there is unmanaged code (uses interop), but there are other
managed ways to acheive this goal too. Unfortunately none of them allow you
to save as MHT but you might not need to do that.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik


"Djavdet" <dj*****@yahoo.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com... Hi everyone,
I need to work with web sites from my program but i don''t need to show
web site content.. I only need to get web page change something in html
document and either move on or send something back..
Basically pretty much the same what usually people would do with IE but
no windows...
I thought that it would be easier to implement using AxWebBrowser
ActiveX control, but I can''t figure out how to set that OCXState field
if I don''t create object within WinForm. If don''t set it , I get
InvalidActiveXStateException...
So I guess my question is, how to use AxWebBrowser control without
WinForm or maybe there is a better way to solve my problem?
Thanks
D.



好吧,

是的,但这让我有点读只访问网站...

我还需要与网站互动或发回一些东西......


D.

Well,
yeah, but that gives me kinda read only access to the web site...
I need also interact with web site or send something back...

D.


这篇关于AxWebBrowser不在WinForm中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆