Untitled

 avatar
unknown
plain_text
a month ago
2.1 kB
3
Indexable
namespace WindowsFormsApp32
{
    public partial class Form1 : Form
    {
        private const string CorrectUsername = "Admin";
        private const string CorrectPassword = "31";

        public Form1()
        {
            InitializeComponent();
            this.Load += new EventHandler(Form1_Load);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            MessageBox.Show("form yüklendi");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string username = textBox1.Text;
            string password = textBox2.Text;

            if (username != CorrectUsername && password != CorrectPassword)
            {
                ShowErrorMessage("kullanıcı adı ve şifre yanlış");
            }
            else if (username != CorrectUsername)
            {
                ShowErrorMessage("kullanıcı adı yanlış");
            }
            else if (password != CorrectPassword)
            {
                ShowErrorMessage("şifre yanlış");
            }
            else
            {
                ShowForm2();
            }
        }

        private void ShowForm2()
        {
            var form2 = new Form2();
            form2.Show();
            this.Hide();
        }

        private void ShowErrorMessage(string message)
        {
            MessageBox.Show(message, "hata", MessageBoxButtons.OK, MessageBoxIcon.Error);

            string vbsScript = @"
Dim message, title
message = WScript.Arguments.Item(0)
title = ""Hata""
Set objMessage = CreateObject(""SAPI.SpVoice"")
Set objVoice = objMessage.GetVoices(""Language=41F"").Item(0) ' Türkçe
objMessage.Voice = objVoice
objMessage.Speak message
MsgBox message, 48, title";

            string tempVbsFile = Path.Combine(Path.GetTempPath(), "error_message.vbs");
            File.WriteAllText(tempVbsFile, vbsScript);

            System.Diagnostics.Process.Start("wscript.exe", $"\"{tempVbsFile}\" \"{message}\"");
        }
    }
}
Editor is loading...
Leave a Comment