c# Console application Open/Get Url by Browser
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的更多相关文章
- win32 console application 如何修改图标?
win32 console application ,不要看这名字高端大气上档次,让你摸不着头脑,其实他就是我们最先学习c语言那种黑色窗口的东西......话说他怎么修改图标呢?第一种方法是:右键-〉 ...
- RESTful Console Application
RESTful Console Application Introduction Inspirited by RESTFul architecture, A console application t ...
- 如何将Console application的Program函数变成支持async的?
如何将Console application的Program函数变成支持async的? class Program { static void Main(string[] args) { Task ...
- Hello World 之 控制台版本(Console Application)
原文:Hello World 之 控制台版本(Console Application) 先来介绍下Hello, World "Hello, World"程序指的是只在计算机屏幕 ...
- Using Spring.net in console application
Download Spring.net in http://www.springframework.net/ Install Spring.NET.exe Create a console appli ...
- 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 ...
- C# 控制台程序(Console Application )启动后隐藏
背景 前段时间给项目编写了数据适配器,读取其他系统的数据后推送到MQ上,我们的系统通过订阅MQ的方式来获取.由于其他系统支持C#编程,且为了一时方便,选择了C#的控制台程序. 最近用户在使用中,总是不 ...
- .NET 如何隐藏Console Application的窗口
1)创建Console Application工程 2)修改Output type 为Windows Application即可
- 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 ...
随机推荐
- oracle中向timeStamp类型字段插入当前时间
to_timestamp(to_char(sysdate,'YYYY-MM-DD HH24:MI:SS'),'YYYY-MM-DD HH24:MI:SS')
- Vscode调试C的多文件工程配置
关于Vscode的C语言的单文件调试,可以参见VScode调试C语言的设置(win10,Linux),里面已经说明基本的配置和使用. 下面说明一下如何调试多个文件的工程,首先写一个简单的工程,其中工程 ...
- Linux---基础指令(一)
https://www.linuxprobe.com/chapter-02.html (Linux就要这么学) 一.执行查看帮助命令 date:date命令用于显示及设置系统的时间或日期,格式为“d ...
- Mac os查看链接过的ssh key
https://shipengliang.com/software-exp/mac-os-如何管理ssh-key.html
- uboot常用的函数
http://blog.csdn.net/ooonebook/article/details/53206623 以下例子都以project X项目tiny210(s5pv210平台,armv7架构)为 ...
- python time库
https://www.cnblogs.com/tkqasn/p/6001134.html
- 为创世纪图书馆(Library Genesis)作镜像
简介 Library Genesis的Wikipedia条目中的介绍是: Library Genesis or LibGen is a search engine for articles and b ...
- jQuery的基本选择器
<script type="text/javascript"> //演示jQuery的基本选择器 $(function () { //通过ID var obj1 = $ ...
- 学习python一个月盘点
1,看了30多个视频,是一些基本操作的.粗略的了解了语法,函数,循环,正则表达,将视频内容全部敲入文本: 2,看了100页的书,习题不太会,进展很慢.第五章10以后的题都没做: 3,看C++的书,有点 ...
- 面向对象一 OOP与类
OOP面向对象 面向对象与面向过程 面向过程让计算机有步骤的顺次做一件事情,是一种过程化的叙事思维:面向对象是一种计算机世界里解决复杂软件工程的方法论,拆解问题复杂度,从人类思维角度提出解决问题的步骤 ...