Dear All,
-
using System;
-
using System.Collections.Generic;
-
using System.ComponentModel;
-
using System.Data;
-
using System.Drawing;
-
using System.Text;
-
using System.Windows.Forms;
-
using System.IO;
-
using System.Runtime.InteropServices;
-
using System.Net;
-
-
-
namespace WindowsFormsApplication5
-
{
-
public partial class Form1 : Form
-
{
-
public Form1()
-
{
-
InitializeComponent();
-
}
-
-
-
[DllImport("user32.dll",CharSet = CharSet.Auto)]
-
private static extern int SystemParametersInfo(int uAction,int uParam,string lpvParam ,intuWinlni);
-
-
private void Form1_Load(object sender, EventArgs e)
-
{
-
-
WebClient WebWay = new WebClient();
-
string url = ""; //圖片的url
-
string NewFileName = ""; //圖片存檔於您的電腦時的新名稱 ※需適時加副檔名
-
string FilePath = @"D:\" + NewFileName; //存檔路徑,理所當然...邏輯區與資料夾需都存在=_=
-
-
WebWay.DownloadFile(url, FilePath); //利用WebWay這個方法下載至本機 參數...(下載路徑,存檔路徑)
-
-
-
-
if (File.Exists(FilePath)) //判別檔案是否存在於對應的路徑
-
{
-
-
int Desktop = 0;
-
-
Desktop = SystemParametersInfo(20, 1, FilePath, 0x1 | 0x2); //存在成立,修改桌布 (uActuin 20 參數為修改wallpaper
-
-
}
-
this.Close(); //執行結束 自動關閉> w <
-
-
-
}
-
}
-
}***** 記錄Domon的學習歷程*****
全站熱搜
留言列表