C 軟體註冊功能

2021-06-03 05:06:52 字數 3413 閱讀 6031

1 using system;

2using system.collections.generic;

3using system.linq;

4using system.text;

5using system.management;67

namespace softregister

8 22

23///

24///

獲取cpu序列號

25///

26///

27public

string getcpu()

28 36

return strcpu;

37 }

3839

///40

///生成機器碼

41///

42///

43public

string getmnum()

44 49

50public

int intcode = new

int[127]; //

儲存金鑰

51public

char charcode = new

char[25]; //

儲存ascii碼

52public

int intnumber = new

int[25]; //

儲存ascii碼值

5354

//初始化金鑰

55public

void setintcode()

56 61 }

6263

///64

///生成註冊碼

65///

66///

67public

string getrnum()

68 75

for (int j = 1; j < intnumber.length; j++) //

改變ascii碼值

76 79

string strasciiname = ""; //

註冊碼80

for (int k = 1; k < intnumber.length; k++) //

生成註冊碼

81 88

else

if (intnumber[k] > 122) //

判斷如果大於z

89 92

else

93 96 }

97return strasciiname;

98 }

99 }

100 }

複製**

註冊窗體:

1

using system;

2using system.collections.generic;

3using system.componentmodel;

4using system.data;

5using system.drawing;

6using system.linq;

7using system.text;

8using system.windows.forms;

9using microsoft.win32;

1011

namespace softregister

12 19

public

static

bool state = true; //

軟體是否為可用狀態

20 softreg softreg = new softreg();

21private

void btnclose_click(object sender, eventargs e)

22

27else

28

31 }

3233

private

void btnreg_click(object sender, eventargs e)

34

44else

45

49 }

50catch (exception ex)

51

54 }

5556

private

void frmregisterform_load(object sender, eventargs e)

57

60 }

61 }

複製**

主窗體:

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 microsoft.win32;

namespace softregister

softreg softreg = new softreg();

private

void btnclose_click(object sender, eventargs e)

private

void btnreg_click(object sender, eventargs e)

//////窗體載入

//////

///private

void frmmainform_load(object sender, eventargs e)

}this.text = "

此軟體尚未註冊!

"; this.btnreg.enabled = true;

messagebox.show("

您現在使用的是試用版,可以免費試用30次!

","資訊

",messageboxbuttons.ok,messageboxicon.information);

int32 tlong;

trycatch

tlong = (int32)registry.getvalue("

hkey_local_machine\\software\\angel

", "

usetimes

", 0);

if (tlong < 30)

else

else }}

}}

軟體新增註冊功能

軟體新增註冊功能 給使用者乙個介面輸入key 注 此key是我用別的工具加密生成 直接寫到使用者電腦的登錄檔中。軟體每次開啟,都會對比登錄檔中的時間與當前時間,以此判斷軟體是否過期,如下 view code 寫入登錄檔 public static void writesetting string s...

C 軟體註冊和註冊

原理就是軟體與序號產生器使用同一種演算法,將資料進行匹配。註冊後將資料寫入至登錄檔中。一種簡單的序號產生器的方式。1 軟體的實現 using system using system.collections.generic using system.linq using system.manageme...

c 註冊熱鍵功能

using system.runtime.interopservices 註冊熱鍵的api dllimport user32 public static extern bool registerhotkey intptr hwnd,int id,uint control,keys vk 解除註冊熱鍵...