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. 哥谭第一季/全集Gotham迅雷下载

    哥谭市 第一季 Gotham (2014)本季看点:<哥谭镇>将由丹尼·加农掌镜,布鲁诺·海勒执笔剧本.电视剧集<哥谭>可以说<蝙蝠侠>的前传,剧集描述的是DC漫画 ...

  2. 唐顿庄园第一至五季/全集Downton Abbey迅雷下载

    本季Downton Abbey 1(2010)看点:ITV古装剧剧<唐顿庄园>由曾因<高斯福德庄园>而荣获奥斯卡的金牌编剧Julian Fellowes一手打造,明星云集的演员 ...

  3. 【转】Itunes Connect新版本如何提交应用

    本文系转载,版权归原作者所有(原文链接>>). How do I submit my app to iTunes connect? To submit your app to iTunes ...

  4. SqlServer 还原数据库 代码实现

    RESTORE DATABASE TargetDB FROM DISK = 'D:\DataBase\DB.bak' with replace, MOVE 'DB' TO 'D:\DataBase\T ...

  5. EditText 限制输入,自定义样式,监听输入的字符,自动换行

    自动获取焦点 <!-- 添加:<requestFocus /> 会自动获取焦点 --> <EditText android:layout_width="matc ...

  6. Node.js SDK与fabric链码交互开发

    1.本篇背景 前面已经对链码开发作了比较详细的介绍,并且对官方提供的 fabcar 链码进行了解读,本篇将介绍如何使用 Node.js SDK 与区块链网络中的链码进行交互. 本篇内容基本来自官方 H ...

  7. Can't create pdf file with font calibri bold 错误解决方案

    错误情况: %%[ ProductName: Distiller ]%% Mangal not found, using Courier. %%[ Error: invalidfont; Offend ...

  8. [leetcode]Path Sum II @ Python

    原题地址:https://oj.leetcode.com/problems/path-sum-ii/ 题意: Given a binary tree and a sum, find all root- ...

  9. [PowerShell Utils] Automatically Change DNS and then Join Domain

    I would like to start a series of blog posts sharing PowerShell scripts to speed up our solution ope ...

  10. 【Spark】SparkStreaming-Tasks-数量如何设置?

    SparkStreaming-Tasks-数量如何设置? sparkstreaming task 数量设置_百度搜索 spark内核揭秘-14-Spark性能优化的10大问题及其解决方案 - star ...