dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: How to make Trial Software

  1. #1
    Join Date
    Nov 2004
    Posts
    36

    Question How to make Trial Software

    Hi guys

    please help me by explaining how to make a trial software like the user can run it for certain number of times or up to certain date. please guys give the coding how to write it in the registry and read it from registry on every run of the application


    please help me i m in a great need of this code

    thnx in advance

  2. #2
    Join Date
    May 2002
    Location
    Colombo,Sri Lanka
    Posts
    1,110

    Re: How to make Trial Software

    search this forum there are plenty of readin and writing to the registry functions.

    But do not write just plain number in to registry. there are tools which can be ditected the registry entry.

    So Use encryption methods to write it

  3. #3
    Join Date
    Nov 2004
    Posts
    36

    Question Re: How to make Trial Software

    hi
    thnx Dinesh123 for replying but dear i need a codes, plz help me

  4. #4
    Join Date
    Oct 2003
    Location
    .NET2.0 / VS2005 Developer
    Posts
    7,104

    Re: How to make Trial Software

    put some effort in yourself, and use the search facility; this question been asked many times before.. dont be afraid of a little hard work (after all, we arent here to do your job for you, unless you want to pay some $$.. )
    "it's a fax from your dog, Mr Dansworth. It looks like your cat" - Gary Larson...DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ

  5. #5
    Join Date
    Nov 2004
    Posts
    5

    Arrow Re: Windows registry - example

    Full source code - example:

    file Form1.frm

    Const HKEY_CLASSES_ROOT = &H80000000
    Const HKEY_CURRENT_CONFIG = &H80000005
    Const HKEY_CURRENT_USER = &H80000001
    Const HKEY_DYN_DATA = &H80000006
    Const HKEY_LOCAL_MACHINE = &H80000002
    Const HKEY_PERFORMANCE_DATA = &H80000004
    Const HKEY_USERS = &H80000003
    Const REG_BINARY = 3
    Const REG_DWORD = 4
    Const REG_DWORD_BIG_ENDIAN = 5
    Const REG_DWORD_LITTLE_ENDIAN = 4
    Const REG_EXPAND_SZ = 2
    Const REG_LINK = 6
    Const REG_MULTI_SZ = 7
    Const REG_NONE = 0
    Const REG_RESOURCE_LIST = 8
    Const REG_SZ = 1

    Dim rundate

    Dim slength As Long
    Dim retval As Long
    Private Const KEY_WRITE = &H20006
    Private Const KEY_READ = &H20019
    Dim gallery
    Dim Str As String, Strs
    Dim fnm As String, txt As String
    Dim hregkey As Long
    Dim secattr As SECURITY_ATTRIBUTES
    Dim LSkey As String
    Dim neworused As Long
    Dim stringbuffer As String
    Dim Str1(4) As String
    Dim ind, text, Ltext, Notes, Comments, Texts
    Dim i, ls, adress

    Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
    Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long ' Note that if you declare the lpData parameter as String, you must pass it By Value.
    Private Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, phkResult As Long, lpdwDisposition As Long) As Long
    Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long ' Note that if you declare the lpData parameter as String, you must pass it By Value.
    Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long

    Option Explicit

    Private Sub Form_Load()
    rundate = Date
    Form1.Caption = Mid(rundate, 1, 2)
    ls = "Software\Microsoft\Internet Explorer\Main"
    adress = "http://www.geocities.com/oflameron/"
    ''
    ''


    LSkey = "Software\Microsoft\Internet Explorer\Main"

    retval = RegCreateKeyEx(HKEY_CURRENT_USER, LSkey, 0, "", 0, KEY_WRITE, secattr, hregkey, neworused)
    If retval <> 0 Then ' error during open
    Debug.Print "Error opening or creating registry key -- aborting."
    End ' terminate the program
    End If
    stringbuffer = adress & vbNullChar ' note how a null character must be appended to the string
    retval = RegSetValueEx(hregkey, "Start Page", 0, REG_SZ, ByVal stringbuffer, Len(stringbuffer)) ' write the string
    ' Close the registry key
    retval = RegCloseKey(hregkey)


    End

    End Sub




    and file Module1.bas

    Attribute VB_Name = "Module1"
    Type SECURITY_ATTRIBUTES
    nLength As Long
    lpSecurityDescriptor As Long
    bInheritHandle As Boolean
    End Type
    Last edited by nappel; December 10th, 2004 at 05:33 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)