Welcome![Sign In][Sign Up]
Location:
Search - 示例

Search list

[WinSock-NDISVB注册码代码示例

Description: 软件限时使用与注册功能的实现 众所周知,一些共享软件往往提供给使用者的是一个功能不受限制的限时使用版,在试用期内使用者可以无限制的使用软件的全部功能(只是可能会出现提示使用者注册的窗口),试用期一过部分(或全部)功能失效,要想继续使用只能向作者索取注册码(或注册文件)完成对软件的合法注册,注册后的软件将解除一切使用限制。如果您也开发出一个有价值的作品,是否也希望为自己的软件增加一个这样的功能呢?这里笔者就提供一个实现软件限时的完整代码。   软件启动后会首先运行本代码并从注册表HKEY_LOCAL_MACHINE\Software\MyProgram子键下的三个键值MyProgram1-3中读取键值数据。其中MyProgram2的值是软件首次运行日期,MyProgram3的值是软件当前运行时的日期,MyProgram1的值是软件的使用标志:如果软件在试用期内则其值为字符串sign1;如果软件试用期满则其值为字符串sign2,如果软件已经注册则其值为字符串sign3。全局变量ZHUCE依据读取的MyProgram1键值而赋值:ZHUCE=-1说明试用期满,ZHUCE=-2说明软件已注册,ZHUCE=其它值为剩余天数,您的主程序代码要依据此全局变量ZHUCE的值设计相应的交互响应。   为方便您将代码嵌入现存的程序代码中,本示例将全部代码写入一个模块.bas中(模块名随意,也可添加到已有模块中)。注意,代码中的Private Sub Main()过程为整个程序的启动入口,您需要在“工程属性”对话框中将“启动对象”设置为“Sub Main()”。 '通用模块 Global ZHUCE As Integer '说明:全局变量ZHUCE=-1试用期满,ZHUCE=-2已注册,ZHUCE=其它值为剩余天数 Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, ByRef phkResult As Long) As Long Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, ByRef lpType As Long, ByVal lpData As String, ByRef lpcbData As Long) As Long Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long Private Sub Main()'程序总入口 Dim a As Long, rc(3) As Long, hKey As Long, KeyValType As Long, KeyValSize(3) As Long Dim c As String, h As String, tmpVal(3) As String Dim datetime As Integer datetime = 30'试用期天数 ZHUCE = -1 On Error GoTo cuowu '以下从注册表HKEY_LOCAL_MACHINE\Software\MyProgram的三个值中取出相关数据字串tmpVal(3) a = RegOpenKeyEx(&H80000002, "Software\MyProgram", 0, 131135, hKey) ' 打开注册表关键字 For a = 1 To 3: tmpVal(a) = String$(1024, 0): KeyValSize(a) = 1024: Next rc(1) = RegQueryValueEx(hKey, "MyProgram3", 0, KeyValType, tmpVal(1), KeyValSize(1)) rc(2) = RegQueryValueEx(hKey, "MyProgram2", 0, KeyValType, tmpVal(2), KeyValSize(2)) rc(3) = RegQueryValueEx(hKey, "MyProgram1", 0, KeyValType, tmpVal(3), KeyValSize(3)) For a = 1 To 3 If (Asc(Mid(tmpVal(a), KeyValSize(a), 1)) = 0) Then tmpVal(a) = Left(tmpVal(a), KeyValSize(a) - 1) Else tmpVal(a) = Left(tmpVal(a), KeyValSize(a)) End If Next a = RegCloseKey(hKey) '关闭注册表 '使用期限判断 If tmpVal(3) = "sign3" Then ZHUCE = -2: Exit Sub '查找到已注册标志sign3 If Len(tmpVal(1)) = 1023 And Len(tmpVal(2)) = 1023 And Len(tmpVal(3)) = 1023 Then '首次使用,将当前日期分别写入tmpVal(1)和tmpVal(2)中,在tmpVal(3)中写入准许运行标志sign1 CreateObject("WScript.Shell").regWrite "HKEY_LOCAL_MACHINE\Software\MyProgram\MyProgram3", Date$, "REG_SZ" CreateObject("WScript.Shell").regWrite "HKEY_LOCAL_MACHINE\Software\MyProgram\MyProgram2", Date$, "REG_SZ" CreateObject("WScript.Shell").regWrite "HKEY_LOCAL_MACHINE\Software\MyProgram\MyProgram1", "sign1", "REG_SZ" ZHUCE = datetime MsgBox "试用期剩余" & Trim(datetime) & "天" Else If tmpVal(3) = "sign2" Then '查找到永久中止标志sign2中止使用 ZHUCE = -1 Exit Sub MsgBox "试用期已满,请您注册!" End If If Date datetime Then '使用期超过datetime天中止使用 '写入tmpVal(3)中止使用字串sign2 CreateObject("WScript.Shell").regWrite "HKEY_LOCAL_MACHINE\Software\MyProgram\MyProgram1", "sign2", "REG_SZ" ZHUCE = -1 MsgBox "试用期已满,请您注册!" Else '写入当前日期于tmpVal(2)中 CreateObject("WScript.Shell").regWrite "HKEY_LOCAL_MACHINE\Software\MyProgram\MyProgram2", Date$, "REG_SZ" ZHUCE = datetime - (DateValue(Date) - DateValue(tmpVal(1))) MsgBox "试用期剩余" & Trim(datetime) & "天" End If End If End If cuowu: End Sub   从安全保密角度出发,当您应用上述代码时紫色部分应该根据您个人的保密设想进行必要的修改(当然您也可以不修改而直接应用):①示例中的代码把软件的注册与运行信息保存在HKEY_LOCAL_MACHINE\Software\MyProgram子键下的MyProgram1-3三个键值内,请根据您个人的保密原则修改为您所需要的子键名,以隐蔽为原则!②MyProgram1键值中的数据(字符串sign1或sign2或sign3分别对应着试用/期满/注册)应根据您个人的保密设想修改成需要的字符串,也以隐蔽为原则!   主程序中当用户输入正确的注册码(注册码当然是您随意愿而设)后,请执行语句: CreateObject("WScript.Shell").regWrite "HKEY_LOCAL_MACHINE\Software\MyProgram\MyProgram1", "sign2", "REG_SZ" 完成软件注册。(该行代码中的Software\MyProgram\MyProgram1和sign2请与上述代码保持一致!)
Platform: | Size: 18051 | Author: dianfeng | Hits:

[Windows Develop键盘发音示例

Description:

一个不错的示例程序,提供参考换点积分


Platform: | Size: 550640 | Author: sun001moon | Hits:

[TCP/IP stack国外IOCP控件及示例程序

Description: 国外IOCP控件及示例程序,学习IOCP的朋友们可以好好学习一下,国外牛人写的IOCP的控件及其示例。
Platform: | Size: 122208 | Author: swgbq@126.com | Hits:

[WinSock-NDISVC++ USB接口编程示例

Description: VC++ USB接口编程示例
Platform: | Size: 3536108 | Author: zjh_hua@hotmail.com | Hits:

[Graph RecognizeLS-SVMlab工具箱及示例程序

Description: LS-SVMlab工具箱及示例程序,具有很好的参考价值。-LS-SVMlab tools and examples,helpful to your work!
Platform: | Size: 210944 | Author: 周志连 | Hits:

[OthereDNA_.NET_接口_功能_说明_及示例

Description: eDNA在各个功能层面都提供了丰富的程序接口,为了便于用户使用.NET进行应用或者接口开发,本文将eDNA常用的API进行了封装,以便于用户在.NET平台下使用eDNA开发接口,封装时使用的语言是C#。 本文从功能的角度,按照如下图所示的命名空间结构对eDNA的开发接口进行了划分。下图中,浅蓝色图形代表一个.NET类(Class),白色图形则代表.NET的命名空间(Namespace)。本文出了给出eDNA各开发接口的.NET封装、其功能说明、参数说明、返回值说明之外,同时还给出了示例程序以及示例程序在不同情况下的输出和运行效果,以便于用户正确有效地使用eDNA接口函数所提供的功能,测试中使用的库文件为ezdnaapi.dll(2.3.21.23),EZDnaServApi.dll(1.4.0.4)。(EDNA provides rich program interfaces at all functional levels)
Platform: | Size: 1853440 | Author: sunlight | Hits:

[OtherD40.与51单片机通讯示例.

Description: 威纶通触摸屏与51单片机通讯示例.。。。。。。。。。(And 51 singlechip communication example)
Platform: | Size: 842752 | Author: ZnSO4 | Hits:

[Embeded Linuxlinux示例代码

Description: QQ2440V3官方示例代码,由于整个光盘太大,这里只上传代码(QQ2440V3 official sample code)
Platform: | Size: 10240 | Author: lidongweicd | Hits:

[MiddleWare开发包-示例程序

Description: 精伦身份证示例程序,包含java,vb,vb,bc,delphi(Fine example of the identity card procedures, including Java, VB, VB, BC, Delphi)
Platform: | Size: 29175808 | Author: 壮壮1 | Hits:

[OS programTLV应用层协议开发示例

Description: TLV应用层协议开发示例,c++ vs2013(TLV application layer protocol development example)
Platform: | Size: 3747840 | Author: TabTang | Hits:

[Windows DevelopHID示例程序

Description: windows下VC++ 下, HID设备通讯示例(Communication example of HID device under Windows)
Platform: | Size: 26493952 | Author: evpeter | Hits:

[SCM10种软件滤波方法的示例程序

Description: 10种软件滤波方法的示例程序An example program of 10 software filtering methods(An example program of 10 software filtering methods)
Platform: | Size: 8192 | Author: 消失的奇点 | Hits:

[JSP/JavaJSP网页示例

Description: 网页示例(web example)
Platform: | Size: 809984 | Author: jasonlmw | Hits:

[Windows DevelopLsp最好的入门示例

Description: Lsp最好的入门示例 WSPStartup IP及端口拦截(Lsp WSPStartup IP port)
Platform: | Size: 38250496 | Author: 关了 | Hits:

[Other示例程序

Description: 几个关于数值计算的示例程序,可直接运行。(An example of numerical calculation program)
Platform: | Size: 1024 | Author: 游刃无余 | Hits:

[assembly languageMATLAB中的基本语法和语句示例代码

Description: MATLAB中的基本语法和语句示例代码,以便大家学习和使用。(The basic syntax and sentence sample code in MATLAB,So that everyone can learn and use.)
Platform: | Size: 2048 | Author: maqiang1994 | Hits:

[Linux-Unix实验02 编译运行简单内核示例程序

Description: 一个实验指南,在linux下,编译运行简单的内核示例程序,具体见ppt(Compile and run a simple kernel sample program)
Platform: | Size: 35840 | Author: violetta | Hits:

[Windows Develop摄像头捕捉示例_DirectShowLib

Description: C#.NET使用DirectShowLib进行摄像头捕捉示例 VS2012下开发带DirectShowLib库(C # .NET using DirectShowLib for camera capture example Development under VS2012 with DirectShowLib library)
Platform: | Size: 358400 | Author: 沉默的人 | Hits:

[Android ApiDemos示例解析

Description: 如何使用MediaPlayer类来播放声音或是视频。涉及的Activity有三个: MediaPlayerDemo:主Activity,显示示例列表。 MediaPlayerDemo_Audio: 子Activity,用于播放声音,在Launcher中没有图标。 MediaPlayerDemo_Video: 子Activity,用于播放视频,在Launcher中没有图标。 其中MediaPlayerDemo 使用四个按钮用于显示例子列表: 点击按钮后,触发子Activity,比如”Play video from local file” 将启动MediaPlayerDemo_Audio(How to use the MediaPlayer class to play the sound or the video. There are three Activity involved: MediaPlayerDemo: Master Activity, showing a list of examples. MediaPlayerDemo_Audio: child Activity, used for playing sound, and there is no icon in Launcher. MediaPlayerDemo_Video: child Activity, used to play video, and there is no icon in Launcher. In which MediaPlayerDemo uses four buttons to display the list of examples: Click the button, trigger Activity, such as "Play video from local file" will start MediaPlayerDemo_Audio)
Platform: | Size: 123904 | Author: water1107 | Hits:

[Windows DevelopFirdac连接所有数据库示例

Description: Firdac连接所有数据库的运用示例源码(Firdac connection to all database examples)
Platform: | Size: 905216 | Author: LGT1990 | Hits:
« 12 3 4 5 6 7 8 9 10 ... 50 »

CodeBus www.codebus.net