如何将Process转换为SHDocVw.InternetExplorer? [英] how can I cast Process to SHDocVw.InternetExplorer ?

查看:109
本文介绍了如何将Process转换为SHDocVw.InternetExplorer?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从

过程<转换 - 转换 -

from

/ font> IEProcess

to 

SHDocVw。 < font color ="#008080"size = 2> InternetExplorer

换句话说我想做下面但是它给了我exeption - 不能施放 -

SHDocVw。 InternetExplorer iex =(SHDocVw。 InternetExplorerClass )IEProcess;

SHDocVw.InternetExplorer iex = (SHDocVw.InternetExplorerClass)IEProcess;

在我监控当前进程后"我做了"并知道这是互联网探索过程

现在我使用SHDocVw监控它。 InternetExplorer

now i monitor it using SHDocVw.InternetExplorer

我该怎么办?

感谢您的帮助

推荐答案

好的,这是不可能做到的!

OK is it impossible to done !!!

好吧我做其他事情将会取而代之的

okay I wqant do other thing will be istead of it

我想知道什么时候打开Internet Explorer - 我想知道 -

I want know when internet explorer is opened - I want imiteadly know that -

但是使用SHDocVw。 InternetExplorer < font color ="#000000"size = 3> NOT Process

BUT using SHDocVw.InternetExplorer NOT Process

以下代码执行但使用process :::

the following code do it but using process :::

/ ********************************************* ************************************************** *************** /

/**************************************************************************************************************/

public void StartWatch()

public void StartWatch()

{

WqlEventQuery query = new WqlEventQuery " __ InstanceCreationEvent" new TimeSpan (0,0,1), " TargetInstance isa \"Win32_Process \"" );

WqlEventQuery query = new WqlEventQuery("__InstanceCreationEvent", new TimeSpan(0, 0, 1), "TargetInstance isa \"Win32_Process\"");

watcher = new ManagementEventWatcher ();

watcher = new ManagementEventWatcher();

watcher.Query = query;

watcher.Query = query;

getDefaultBrowser();

getDefaultBrowser();

string ep;

string ep;

do

do

{

ManagementBaseObject e = watcher.WaitForNextEvent();

ManagementBaseObject e = watcher.WaitForNextEvent();

ep =(( ManagementBaseObject )e [ " TargetInstance" ])[ " Name" ]。ToString();

ep=((ManagementBaseObject)e["TargetInstance"])["Name"].ToString();

if (ep == " iexplore。 exe"

if (ep == "iexplore.exe" )

{

处理 pr = 处理 .GetProcessById( int .Parse(( ManagementBaseObject )e [ " TargetInstance" ] )[ " Processid" ]。ToString()));

Process pr = Process.GetProcessById(int.Parse(((ManagementBaseObject)e["TargetInstance"])["Processid"].ToString()));

//现在流程pr是互联网资源管理器

// The process pr now is the internet explorer just obent

//我想将其转换为SHDocVw.InternetExplorer

// I want convert it to SHDocVw.InternetExplorer

//即可访问,即我想要

// to be access on ie as i want

}

} while (< font color ="#0000ff"> true );

} while (true);

}

/ *************** ************************************************** ************* /

/**************************************************************************************************************/

另一种方式我需要只使用上一个代码来观看Internet Explorer,但是使用SHDocVw。 InternetExplorer

The other way i need to watch just internet explorer as the previous code da but using SHDocVw.InternetExplorer 

如何???

/ ******** ************************************************** ************************************************** ** /

/**************************************************************************************************************/


这篇关于如何将Process转换为SHDocVw.InternetExplorer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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