| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Visual Basic 6.0 Programming Ask questions about VB 6.0 (or earlier versions) or help others by answering their question. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
|
||||
|
||||
|
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
|
|||
|
|||
|
hi
thnx Dinesh123 for replying but dear i need a codes, plz help me |
|
#4
|
||||
|
||||
|
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
|
|||
|
|||
|
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
__________________
Free Tutorials Last edited by nappel; December 10th, 2004 at 05:33 AM. |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|