1:通过SPY++获得地址栏的层次结构,然后一层一层获得

2:代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices; namespace ConsoleApplication4
{
class Program
{
[DllImport("user32.dll")]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
[DllImport("user32.dll")]
static extern int SendMessage(IntPtr hWnd, uint Msg, int wParam, StringBuilder lParam); const int WM_GETTEXT = 0x000D; //获得文本消息的16进制表示 static void Main(string[] args)
{ //chrome.exe IEXPLORE.EXE System.Diagnostics.Process.Start("IEXPLORE.EXE", "http://127.0.0.1:7001/console/login/LoginForm.jsp"); System.Threading.Thread.Sleep(); //获得IE窗口句柄
IntPtr hWnd = FindWindow("IEFrame", null); System.Console.WriteLine("hWnd:" + hWnd); IntPtr child = FindWindowEx(hWnd, IntPtr.Zero, "WorkerW", null);
child = FindWindowEx(child, IntPtr.Zero, "ReBarWindow32", null);
child = FindWindowEx(child, IntPtr.Zero, "Address Band Root", null);
child = FindWindowEx(child, IntPtr.Zero, "Edit", null); //通过SPY++获得地址栏的层次结构,然后一层一层获得 if (child != null)
{
StringBuilder buffer = new StringBuilder();
int num = SendMessage(child, WM_GETTEXT, , buffer); System.Console.WriteLine("num:" + num); string strUrl = buffer.ToString(); System.Console.WriteLine("URL:" + strUrl);
} Console.ReadLine();
} }
}

3:运行结果

C# 通过SendMessage获取浏览器地址栏的地址的更多相关文章

  1. JS获取浏览器地址栏的多个参数值的任意值

    getParamValue("id"); //http://localhost:2426/TransactionNotes.aspx?id=100 //返回值是100: // 根据 ...

  2. vue获取浏览器地址栏参数(?及/)路由+非路由实现方式

    1.? 参数 浏览器参数形式:http://javam4.com/m4detail?id=1322914793170014208 1.1.路由取参方式 this.$route.query.id 前端跳 ...

  3. 使用js获取浏览器地址栏里的参数

    用JS获取地址栏参数的方法(超级简单) 方法一:采用正则表达式获取地址栏参数:( 强烈推荐,既实用又方便!) function GetQueryString(name) { var reg = new ...

  4. JS获取浏览器地址栏的多参数值的任意值

    常用的几个方法就不讲了,这里我用的是两个方法组 使用方法是: getParamValue("id"); http://localhost:2426/TransactionNotes ...

  5. js获取浏览器地址栏传递的参数

    function getQueryString(key){ var href=window.location.href; var reg = new RegExp(key +"=([^&am ...

  6. 通过sohu获取浏览器端IP地址

    接口:http://pv.sohu.com/cityjson?ie=utf-8

  7. js获取浏览器上一访问页面URL地址,document.referrer方法

    如题,可用document.referrer方法获取上一页面的url 但是也有不可使用的情况 直接在浏览器地址栏中输入地址: 使用location.reload()刷新(location.href或者 ...

  8. 把post请求的地址粘贴到浏览器地址栏敲回车报错405[Method Not Allowed]

    为什么把post请求的地址粘贴到浏览器地址栏敲回车会报405?原因:在浏览器地址栏敲回车,浏览器默认是以get方式发送请求,而你的请求是post,这样当然会报405了: 405:方法不允许,不支持ge ...

  9. js获取当前浏览器地址栏的链接,然后在链接后面加参数

    比如访问www.baidu.com,url显示成www.baidu.com/?form <script type="text/javascript"> if(locat ...

随机推荐

  1. Xcode工程文件打不开:cannot be opened because the project file cannot be parsed

    svn更新代码后,打开xcode工程文件,会出现  xxx..xcodeproj  cannot be opened because the project file cannot be parsed ...

  2. Auto Layout on iOS Versions prior to 6.0

    使用XCODE5.0,出现这个小错误... 解决办法: 选中你的XIB或storyboard,如下图 再查看右边属性栏 去掉最下边的Use Autolayout ,完成. 转:http://blog. ...

  3. Android 实时视频编码—H.264硬编码

    from://http://www.cnblogs.com/skyseraph/archive/2012/04/04/2431771.html 1  硬编码 & 软编码 硬编码:通过调用And ...

  4. python测试开发django-36.一对一(OneToOneField)关系查询

    前言 前面一篇在xadmin后台一个页面显示2个关联表(OneToOneField)的字段,使用inlines内联显示.本篇继续学习一对一(OneToOneField)关系的查询. 上一篇list_d ...

  5. Android中的输入法

    提起输入法我就想到了Edittext,输入法可以自动根据inputType来改变键盘的布局,在支付钱包中还特别隐藏的系统自带的输入法,直接让用户用软件自己的输入法,提高了安全性.所以,我们应该对输入法 ...

  6. 自定义的开关按钮——SwitchButton

    本文转自:http://blog.csdn.net/swust_chenpeng/article/details/19967501 我将原文的控件进行了一些修改,去掉了原来控件的外边框,只留下重要的遮 ...

  7. PHP Curl实例

    URL Link : http://www.groad.net/bbs/forum-115-1.html

  8. Java调用DLL有多种方式,常用的方式有JNative、JNA、JNI等。

    JNative方式调用dll JNative是一种能够使Java语言使调用DLL的一种技术,对JNI进行了封装,可能有些读者会有这样一个问题,JNative对JNI进行了封装,并且是一种跨语言的使用D ...

  9. RocketMQ logback使用实践

    logback_broker.xml <?xml version="1.0" encoding="UTF-8"?> <!-- Licensed ...

  10. 奇怪吸引子---Coullet

    奇怪吸引子是混沌学的重要组成理论,用于演化过程的终极状态,具有如下特征:终极性.稳定性.吸引性.吸引子是一个数学概念,描写运动的收敛类型.它是指这样的一个集合,当时间趋于无穷大时,在任何一个有界集上出 ...