Windows多线程
//简单的引出多线程是肿么回事儿。。。。当点击下载的时候,下载内容还没结束也可以点击资源库,其实这就用了另一个线程,弹出“下载完成”对话框的时候,没有点击确定是不能点击主页面内容的,这就是用------Action action = new Action(Msg); this.Invoke(action);------把对话框交给主页面去处理
namespace Windows多线程
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnDownload_Click(object sender, EventArgs e)
{
this.backgroundWorker1.RunWorkerAsync();
}
private void btnZiYuanKu_Click(object sender, EventArgs e)
{
MessageBox.Show("精彩大片,应有尽有");
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
for (int i = 30320; i < 30340; i++)
{
try
{
WebClient client = new WebClient();
client.DownloadFile(@"http://job.cnblogs.com/offer/" + i + "/", @"E:\movices\" + i + ".html");
}
catch (Exception ex)
{ }
}
Action action = new Action(Msg);
this.Invoke(action);
}
private void Msg()
{
MessageBox.Show("下载成功");
}
}
}
Windows多线程的更多相关文章
- Windows多线程多任务设计初步(转)
Windows多线程多任务设计初步 [前言:]当前流行的Windows操作系统,它能同时运行几个程序(独立运行的程序又称之为进程),对于同一个程序,它又可以分成若干个独立的执行流,我们称之为线程,线程 ...
- windows多线程编程星球(一)
以前在学校的时候,多线程这一部分是属于那种充满好奇但是又感觉很难掌握的部分.原因嘛我觉得是这玩意儿和编程语言无关,主要和操作系统的有关,所以这部分内容主要出现在讲原理的操作系统书的某一章,看完原理是懂 ...
- windows多线程没那么难
windows多线程没那么难 作者:vpoet mail:vpoet_sir@163.com 上一博文中我们引入了CreateThread()多线程编程一个简单的例子,事实上我说windows 多线程 ...
- 总结windows多线程同步互斥
windows多线程同步互斥--总结 我的windows多线程系列文章: windows多线程--原子操作 windows多线程同步--事件 windows多线程同步--互斥量 windows多线程同 ...
- Windows多线程学习随笔
自学Windows多线程知识,例程如下: #include <iostream> #include <windows.h> #include <process.h> ...
- windows多线程同步互斥--总结
我的windows多线程系列文章: windows多线程--原子操作 windows多线程同步--事件 windows多线程同步--互斥量 windows多线程同步--临界区 windows多线程同步 ...
- windows多线程同步--临界区
推荐参考博客:秒杀多线程第五篇 经典线程同步 关键段CS 关于临界区的观念,一般操作系统书上面都有. 适用范围:它只能同步一个进程中的线程,不能跨进程同步.一般用它来做单个进程内的代码快同步,效率 ...
- windows多线程接口介绍和使用
一windows多线程接口: 1 创建线程 CreateThread 与 _beginthreadex都可以实现创建线程,两个函数的参数 相同, HANDLEWINAPICreateThread( L ...
- Windows多线程编程入门
标签(空格分隔): Windows multithread programming 多线程 并发 编程 背景知识 在开始学习多线程编程之前,先来学习下进程和线程 进程 进程是指具有一定独立功能的程序在 ...
随机推荐
- c基础总结
机器大小端判断: #include <stdio.h> typedef union{ char x; int i; }un; int main() { un tt; tt.i = ; ) ...
- 转换DataSet中的多个表为Excel中的多个Sheets
第一种方法: 1. 在设计页面,有一个button按钮,当用户单击按钮的时候,发生转换 <asp:Button ID="Export" runat="server& ...
- Mysql的执行顺序
参考:http://blog.csdn.net/jintao_ma/article/details/51253356 http://www.cnblogs.com/rollenholt/p/37769 ...
- Enze Third day(c#中选择结构【if...else】)
哈喽,又到了我总结课堂知识的时间了.今天在云和学院学的是C#中的“选择结构”下的If语句.下面就来总结一下今天所学的吧. 理论:If语句是最常用的选择结构语句.它主要根据所给定的条件(常由关系表达式和 ...
- [翻译]Orchard-修改首页布局
前言 Orchard在你的站点应用的默认主题叫做”Theme Machine”.该主题包括CSS样式和一个布局框架. Orchard 允许你选择或排除显示在你站点每个页面的布局. 默认情况下下图中蓝色 ...
- URAL DP第一发
列表: URAL 1225 Flags URAL 1009 K-based Numbers URAL 1119 Metro URAL 1146 Maximum Sum URAL 1203 Scient ...
- Week 5a - Mouse input and more lists----learning notes
pyton 程序内容的颠倒,运用 [](列表) def reverse_string(s): """Returns the reversal of the given s ...
- java int and string convert
int -> String int i=12345; String s=""; 第一种方法:s=i+""; 第二种方法:s=String.valueOf( ...
- The Power of Reading——英语学习小技巧之七
This method is "The Power of Reading" and it comes from an article by Dr.Stephen Krashen. ...
- matlab实现协同过滤之pdist、squareform
实现协同过滤算法的第一步是:计算用户或项目之间的相似度.接下来介绍pdist和squareform 用法: D = pdist(X) D = pdist(X,distance) D = pdist ...