Friday, November 23, 2012

C# Tutorial: How to create a program that self replicates!

// Namespaces that you need
using System.Diagnostics;
using System.IO;

// The Replication Code
for (int i = 1; i <= 5; i++)
{
    string exec = Application.ExecutablePath;
    exec = exec.Insert(exec.IndexOf("."), i.ToString());
    File.Copy(Application.ExecutablePath, exec);
    Process.Start(exec);
}
// You can replace 5 with whatever number you want
// However, be carefull!

Sunday, November 18, 2012

How to create a Windows Forms Application Project in Visual C++ Express 2012

Add this code to your main source file. In my tutorial that is MyForm.cpp

using namespace System;
using namespace System::Windows::Forms;

[STAThread]
void Main(array<String^>^ args)
{
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false);

    FormsTutorial::MyForm form;
    Application::Run(%form);
}