Your goal is to create a keygen and make a tutorial and/ or write instructions about the steps done by you.
What is C++/CLI?
C++/CLI is C++ support .NET framework to make managed application run on .NET framework.
https://en.wikipedia.org/wiki/C%2B%2B/CLI
Feel free to post your solutions.
#pragma once
#include <Windows.h>
#include "md5.h"
namespace CppCLR_WinformsProjekt {
/*
this->rtBox->Anchor = static_cast<System::Windows::Forms::AnchorStyles>
(System::Windows::Forms::AnchorStyles::Top |
System::Windows::Forms::AnchorStyles::Bottom |
System::Windows::Forms::AnchorStyles::Left |
System::Windows::Forms::AnchorStyles::Right);
*/
void MsgBox(void);
int MinValue(std::string l, std::string r);
//typedef int(*MathFunc)(float, int);
typedef void(*MyFunc)(void);
extern MyFunc pFunc ;
//MyFunc pFunc = nullptr;
void myAsmFunc(std::string s);
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Zusammenfassung für Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
// This declares a delegate type that takes no parameters.
delegate void DecayProcessFunc();
static void MyMsgBox(void)
{
//::MessageBox(::GetDesktopWindow(), L"License key is correct.", L"Cap", 0);
Form1 ^pf = (CppCLR_WinformsProjekt::Form1^)Application::OpenForms[0];
pf->label1->Text = "Thank license key is valid";
}
static void MyMsgBoxInvalid(void)
{
//::MessageBox(::GetDesktopWindow(), L"License key is correct.", L"Cap", 0);
Form1 ^pf = (CppCLR_WinformsProjekt::Form1^)Application::OpenForms[0];
pf->label1->Text = "License key is invalid";
}
Form1(void)
{
InitializeComponent();
//
//TODO: Konstruktorcode hier hinzufügen.
//
}
protected:
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::RichTextBox^ richTextBox1;
private: System::Windows::Forms::Label^ label1;
public: System::Windows::Forms::Label^ label2;
protected:
private:
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
void InitializeComponent(void)
{
this->button1 = (gcnew System::Windows::Forms::Button());
this->richTextBox1 = (gcnew System::Windows::Forms::RichTextBox());
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->SuspendLayout();
//
// button1
//
this->button1->Location = System::Drawing::Point(343, 317);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 0;
this->button1->Text = L"button1";
this->button1->UseVisualStyleBackColor = true;
this->button1->Visible = false;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// richTextBox1
//
this->richTextBox1->Location = System::Drawing::Point(148, 84);
this->richTextBox1->Name = L"richTextBox1";
this->richTextBox1->Size = System::Drawing::Size(494, 174);
this->richTextBox1->TabIndex = 1;
this->richTextBox1->Text = L"";
this->richTextBox1->TextChanged += gcnew System::EventHandler(this, &Form1::richTextBox1_TextChanged);
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(227, 276);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(46, 17);
this->label1->TabIndex = 2;
this->label1->Text = L"label1";
//
// label2
//
this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(47, 153);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(95, 17);
this->label2->TabIndex = 3;
this->label2->Text = L"License key : ";
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(709, 439);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Controls->Add(this->richTextBox1);
this->Controls->Add(this->button1);
this->Margin = System::Windows::Forms::Padding(4);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
MessageBox::Show("Hi");
}
private: System::Void richTextBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
richTextBox1->SelectionColor = System::Drawing::Color::Black;
array<wchar_t> ^text = richTextBox1->Text->ToCharArray();
pin_ptr<wchar_t> pin = &text[0];
pin_ptr<wchar_t> p = &text[0];
char cs[1000] = { 0 };
wcstombs(cs, p, 1000);
myAsmFunc(std::string(cs));// "d69ad26fca3514061cc906a43d4b4af0");
//if(pFunc != nullptr)
pFunc();
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
};
}
Recommended Comments