C# url 用 浏览器打开、C#获取浏览器的url

 static void Main(string[] args)
{
string file = @"C:\Users\Hero\Desktop\SiteWhitelist.tsv";
string[] lines = System.IO.File.ReadAllLines(file);
foreach (var url in lines)
{ var startInfo = new ProcessStartInfo("firefox.exe", url);
Process.Start(startInfo);
string getUrl = GetBrowserURL("FireFox");
Thread.Sleep();
File.WriteAllText(@"C:\Users\Hero\Desktop\SaveSiteWhitelist.txt",
getUrl + Environment.NewLine + File.ReadAllTex (@"C:\Users\Hero\Desktop\SaveSiteWhitelist.txt"));
}
Console.ReadKey();
}
public static string GetBrowserURL(string browser)
{
try
{
DdeClient dde = new DdeClient(browser, "WWW_GetWindowInfo");
dde.Connect();
string url = dde.Request("URL", int.MaxValue);
string[] text = url.Split(new string[] { "\",\"" }, StringSplitOptions.RemoveEmptyEntries);
dde.Disconnect();
return text[].Substring();
}
catch
{
return null;
}
}

c# Console application Open/Get Url by Browser的更多相关文章

  1. win32 console application 如何修改图标?

    win32 console application ,不要看这名字高端大气上档次,让你摸不着头脑,其实他就是我们最先学习c语言那种黑色窗口的东西......话说他怎么修改图标呢?第一种方法是:右键-〉 ...

  2. RESTful Console Application

    RESTful Console Application Introduction Inspirited by RESTFul architecture, A console application t ...

  3. 如何将Console application的Program函数变成支持async的?

    如何将Console application的Program函数变成支持async的?   class Program { static void Main(string[] args) { Task ...

  4. Hello World 之 控制台版本(Console Application)

    原文:Hello World 之 控制台版本(Console Application) 先来介绍下Hello, World   "Hello, World"程序指的是只在计算机屏幕 ...

  5. Using Spring.net in console application

    Download Spring.net in http://www.springframework.net/ Install Spring.NET.exe Create a console appli ...

  6. Fix Visual Studio 2013 Razor CSHTML Intellisense in Class Library or Console Application

    https://mhusseini.wordpress.com/2015/02/05/fix-visual-studio-2013-razor-cshtml-intellisense-in-class ...

  7. C# 控制台程序(Console Application )启动后隐藏

    背景 前段时间给项目编写了数据适配器,读取其他系统的数据后推送到MQ上,我们的系统通过订阅MQ的方式来获取.由于其他系统支持C#编程,且为了一时方便,选择了C#的控制台程序. 最近用户在使用中,总是不 ...

  8. .NET 如何隐藏Console Application的窗口

    1)创建Console Application工程 2)修改Output type 为Windows Application即可

  9. VS2015 create a C++ console application based on WinRT

    1. Enable /ZW 2. Disable /Gm 3. #using C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcpack ...

随机推荐

  1. DataTable调整顺序

    DataTable中手动调整列的顺序 DataTable中手动调整列的顺序(列序,reorder,Rearrange)DataTable dt = new DataTable(); dt.Column ...

  2. 《Linux就该这么学》第十四天课程

    samba服务的配置文件解读 samba服务解决了Linux系统与Windows系统之间的文件共享问题,是一个非常不错的服务 原创地址:https://www.linuxprobe.com/chapt ...

  3. 小白的CTF学习之路8——节约内存的编程方式

    今天第二更,废话不说上干货 上一章我们学习了内存和cpu间的互动方式,了解到内存的空间非常有限,所以这样就需要我们在编程的时候尽可能的节省内存空间,用最少的空间发挥最大的效果,以下是几种节约内存的方法 ...

  4. idea取消vim模式

    在安装idea时选择了vim编辑模式,但是用习惯了eclipse,总是要拷贝粘贴,在idea中一直按ctrl+c和ctrl+v不起总用.于是想把vim模式关闭掉.方法:菜单栏:tools->vi ...

  5. Unity中AB资源打包简单的脚本

    脚本应该放在Editor文件夹下 using System.Collections; using System.Collections.Generic; using UnityEngine; usin ...

  6. MySQL定时器

    MySQL的定时器是一个很有用的功能,有时候需要数据库自动根据时间进行一些必要的操作,此时定时器就派上了用场了. 一.查看MySQL版本号 select version(); 二.查看event的状态 ...

  7. HTML基本格式和文本元素(标签)介绍

    <!doctype html>//声明文档类型 <html lang="zh-cn">//文档开始,后面是声明是中文页面的意思,en是英语的意思 <h ...

  8. 《python语言程序设计》_第三章(数字函数、字符串和对象)

    3.2_常见的Python函数 (1) abs()函数 求绝对值 (2) max(x1,x2,x3,....)求最大值 (3) min(x1,x2,x3,....)求最小值 (4) pow 返回a的b ...

  9. linux redis 多实例安装

    前言: Redis 是一个开源(BSD许可)的,内存中的数据结构存储系统,它可以用作数据库.缓存和消息中间件. 它支持多种类型的数据结构,如 字符串(strings), 散列(hashes), 列表( ...

  10. Akka-Cluster(5)- load-balancing with backoff-supervised stateless computation - 无状态任务集群节点均衡分配

    分布式程序运算是一种水平扩展(scale-out)运算模式,其核心思想是能够充分利用服务器集群中每个服务器节点的计算资源,包括:CPU.内存.硬盘.IO总线等.首先对计算任务进行分割,然后把细分的任务 ...