using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
[DllImport("kernel32.dll")]
public static extern int GetCurrentProcessId();
public Form1()
{
InitializeComponent();
}
[B] private void button1_Click(object sender, EventArgs e)
{
if (GetCurrentProcessId() != 1234)
MessageBox.Show("No");
else
MessageBox.Show("Yes");
}[/B]
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[B] private void button1_Click(object sender, EventArgs e)
{
Random r = new Random();
if (textBox1.Text != r.Next().ToString())
MessageBox.Show("No");
else
MessageBox.Show("OK");
}[/B]
}
}