Solved

How to add my program to windows registry

Posted on 2006-11-15
4
128 Views
Last Modified: 2010-04-30

Hi my problem is that when I made my package it works perfectly but if I want to search in the windows registry for my app , in the registry I found nothing how can I put my app in //software//my app in wondows registry at local machine

 is this possible
0
Comment
Question by:pedro_arzac
  • 3
4 Comments
 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
ID: 17951979
Here are some permutation routines you can use.

Public Enum SamplingMethod
   DiscardAfterChoosing = 1
   ReturnAfterChoosing = 2
End Enum

Private Function AssembleResults( _
   ByRef Results As Collection, _
   ByVal SlotDelimiter As String) As Collection
   
' Combines results into strings with elements separated by SlotDelimiter.
   
   Dim AssembledResult As String
   Dim SelectionIndex As Long
   Dim ElementIndex As Long
   
   Set AssembleResults = New Collection
   For SelectionIndex = 1 To Results.Count
      AssembledResult = Results(SelectionIndex)(1)
      If Results(SelectionIndex).Count > 1 Then
         For ElementIndex = 2 To Results(SelectionIndex).Count
            AssembledResult = AssembledResult & SlotDelimiter & Results(SelectionIndex)(ElementIndex)
         Next
      End If
      AssembleResults.Add AssembledResult
   Next
   
End Function

Private Sub BuildCombinations( _
   ByRef SampleList As Collection, _
   ByVal SelectionSize As Long, _
   ByRef SampleListIndex() As Long, _
   ByVal SelectionCount As Long, _
   ByRef Permutations As Collection)
   
' Returns all combinations of sample list in lexicographic order.
' (0 1 2 3), 3 => ((0 1 2) (0 1 3) (0 2 3) (1 2 3))
' Selection size must be less than or equal to the number of SampleList elements.
' SampleListIndex must contain at least SelectionSize elements.
   
   Dim Index As Long
   Dim StartIndex As Long
   Dim Permutation As Collection
   
   If SelectionCount = SelectionSize Then
      ' Build new permutation and add to collection
      Set Permutation = New Collection
      For Index = 1 To SelectionSize
         Permutation.Add SampleList(SampleListIndex(Index))
      Next
      Permutations.Add Permutation
   Else
      If SelectionCount = 0 Then
         StartIndex = 1
      Else
         StartIndex = SampleListIndex(SelectionCount) + 1
      End If
      For Index = StartIndex To SampleList.Count - SelectionSize + SelectionCount + 1
         ' Refer to current sample element
         SelectionCount = SelectionCount + 1
         SampleListIndex(SelectionCount) = Index
         ' Continue until last sample element used
         BuildCombinations SampleList, SelectionSize, SampleListIndex, SelectionCount, Permutations
         SelectionCount = SelectionCount - 1
      Next
   End If
   
End Sub

Private Sub BuildPermutationsMultipleLists( _
   ByRef SampleLists As Collection, _
   ByRef SampleListIndex() As Long, _
   ByVal SelectionCount As Long, _
   ByRef Permutations As Collection)
   
' Returns all permutations of multiple sample lists.
   
   Dim Index As Long
   Dim Permutation As Collection
   
   If SelectionCount = UBound(SampleListIndex) Then
      ' Build new permutation and add to collection
      Set Permutation = New Collection
      For Index = 1 To SampleLists.Count
         Permutation.Add SampleLists(Index)(SampleListIndex(Index))
      Next
      Permutations.Add Permutation
   Else
      For Index = 1 To SampleLists(SelectionCount + 1).Count
         ' Refer to current sample element
         SelectionCount = SelectionCount + 1
         SampleListIndex(SelectionCount) = Index
         ' Continue until last sample element used
         BuildPermutationsMultipleLists SampleLists, SampleListIndex, SelectionCount, Permutations
         SelectionCount = SelectionCount - 1
      Next
   End If

End Sub

Private Sub BuildPermutationsNoReturn( _
   ByRef SampleList As Collection, _
   ByRef SampleListIndex() As Long, _
   ByRef SampleListUsed() As Boolean, _
   ByVal SelectionCount As Long, _
   ByRef Permutations As Collection)
   
' Returns all permutations of sample list in lexicographic order without returning to sample.
' (0 1 2) => ((0 1 2) (0 2 1) (1 0 2) (1 2 0) (2 0 1) (2 1 0))
' Number of elements in SampleListIndex is selection size and must equal number of elements in SampleList.
' Number of elements in SampleListUsed must be same as number of elements in SampleListIndex.
   
   Dim Index As Long
   Dim Permutation As Collection
   
   If SelectionCount = UBound(SampleListIndex) Then
      ' Build new permutation and add to collection
      Set Permutation = New Collection
      For Index = 1 To SampleList.Count
         Permutation.Add SampleList(SampleListIndex(Index))
      Next
      Permutations.Add Permutation
   Else
      For Index = 1 To SampleList.Count
         If Not SampleListUsed(Index) Then
            ' Mark this sample element used
            SampleListUsed(Index) = True
            ' Refer to current sample element
            SelectionCount = SelectionCount + 1
            SampleListIndex(SelectionCount) = Index
            ' Continue until last sample element used
            BuildPermutationsNoReturn SampleList, SampleListIndex, SampleListUsed, SelectionCount, Permutations
            SelectionCount = SelectionCount - 1
            SampleListUsed(Index) = False
         End If
      Next
   End If
   
End Sub

Private Sub BuildPermutationsReturn( _
   ByRef SampleList As Collection, _
   ByRef SampleListIndex() As Long, _
   ByRef SampleListUsed() As Boolean, _
   ByVal SelectionCount As Long, _
   ByRef Permutations As Collection)
   
' Returns all permutations of sample list in lexicographic order with returning to sample.
' (0 1 2) => ((0 0 0) (0 0 1) (0 0 2) (0 1 0) (0 1 1) (0 1 2) (0 2 0) ... (2 2 2))
' Number of elements in SampleListIndex is selection size and must equal number of elements in SampleList.
' Number of elements in SampleListUsed must be same as number of elements in SampleListIndex.

   Dim Index As Long
   Dim Permutation As Collection
   
   If SelectionCount = UBound(SampleListIndex) Then
      ' Build new permutation and add to collection
      Set Permutation = New Collection
      For Index = 1 To SampleList.Count
         Permutation.Add SampleList(SampleListIndex(Index))
      Next
      Permutations.Add Permutation
   Else
      For Index = 1 To SampleList.Count
         ' Refer to current sample element
         SelectionCount = SelectionCount + 1
         SampleListIndex(SelectionCount) = Index
         ' Continue until last sample element used
         BuildPermutationsReturn SampleList, SampleListIndex, SampleListUsed, SelectionCount, Permutations
         SelectionCount = SelectionCount - 1
      Next
   End If

End Sub

Private Sub BuildSequences( _
   ByRef SampleList As Collection, _
   ByVal MinSelectionSize As Long, _
   ByVal MaxSelectionSize As Long, _
   ByRef Permutations As Collection)
   
' Builds all sequences of sample list.
' (0 1 2 3), Min=2, Max=4 => ((0 1) (0 1 2) (0 1 2 3) (1 2) (1 2 3) (2 3))
' MinSelectionSize must be greater than or equal to 1 and less than or equal to MaxSelctionSize.
' MaxSelectionSize must be greater than or equal to 1 and less than or equal to number of SampleList elements.
   
   Dim FirstIndex As Long
   Dim LastIndex As Long
   Dim Index As Long
   Dim Permutation As Collection
   
   For FirstIndex = 1 To SampleList.Count - MinSelectionSize + 1
      For LastIndex = FirstIndex + MinSelectionSize - 1 To Min(FirstIndex + MaxSelectionSize - 1, SampleList.Count)
         Set Permutation = New Collection
         For Index = FirstIndex To LastIndex
            Permutation.Add SampleList(Index)
         Next
         Permutations.Add Permutation
      Next
   Next

End Sub

Public Function Combinations( _
   ByRef SampleList As Collection, _
   ByVal MinSelectionSize As Long, _
   ByVal MaxSelectionSize As Long, _
   Optional ByVal SlotDelimiter As Variant) As Collection

' Builds and returns all combinations.

   Dim Results As New Collection
   Dim SelectionSize As Long
   Dim SampleListIndex() As Long
   Dim SelectionCount As Long
   
   For SelectionSize = MinSelectionSize To MaxSelectionSize
      ReDim SampleListIndex(1 To SelectionSize)
      SelectionCount = 0
      BuildCombinations SampleList, SelectionSize, SampleListIndex, SelectionCount, Results
   Next
   If Not IsMissing(SlotDelimiter) Then
      Set Combinations = AssembleResults(Results, CStr(SlotDelimiter))
   Else
      Set Combinations = Results
   End If

End Function

Public Function Permutations( _
   ByRef SampleList As Collection, _
   ByVal MinSelectionSize As Long, _
   ByVal MaxSelectionSize As Long, _
   ByVal SamplingMethod As SamplingMethod, _
   Optional ByVal SlotDelimiter As Variant) As Collection
   
' Builds and returns all permutations.

   Dim Combinations As New Collection
   Dim Combination As Collection
   Dim Results As New Collection
   Dim SelectionSize As Long
   Dim SampleListIndex() As Long
   Dim SampleListUsed() As Boolean
   Dim SelectionCount As Long
   
   For SelectionSize = MinSelectionSize To MaxSelectionSize
      ReDim SampleListIndex(1 To SelectionSize)
      ReDim SampleListUsed(1 To SelectionSize)
      Set Combinations = Nothing
      BuildCombinations SampleList, SelectionSize, SampleListIndex, SelectionCount, Combinations
      For Each Combination In Combinations
         If SamplingMethod = DiscardAfterChoosing Then
            BuildPermutationsNoReturn Combination, SampleListIndex, SampleListUsed, SelectionCount, Results
         Else
            BuildPermutationsReturn Combination, SampleListIndex, SampleListUsed, SelectionCount, Results
         End If
      Next
   Next
   If Not IsMissing(SlotDelimiter) Then
      Set Permutations = AssembleResults(Results, CStr(SlotDelimiter))
   Else
      Set Permutations = Results
   End If

End Function

Public Function Sequences( _
   ByRef SampleList As Collection, _
   ByVal MinSelectionSize As Long, _
   ByVal MaxSelectionSize As Long, _
   Optional ByVal SlotDelimiter As Variant) As Collection

' Builds and returns all sequences.

   Dim Results As New Collection
   
   BuildSequences SampleList, MinSelectionSize, MaxSelectionSize, Results
   If Not IsMissing(SlotDelimiter) Then
      Set Sequences = AssembleResults(Results, CStr(SlotDelimiter))
   Else
      Set Sequences = Results
   End If

End Function

Public Function Min( _
      ParamArray ValueArray() As Variant _
   ) As Variant

' Return the minimum value in the parameter list.

   Dim Value As Variant
   
   If UBound(ValueArray) = -1 Then Exit Function
   Min = ValueArray(0)
   For Each Value In ValueArray
      If Value < Min Then Min = Value
   Next

End Function

Kevin
0
 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
ID: 17952019
Please ignore the above post. EE was having some difficulties with accepting posts and I posted to the wrong question.

Kevin
0
 
LVL 81

Accepted Solution

by:
zorvek (Kevin Jones) earned 500 total points
ID: 17952025
What installer are you using? Have you considered using INNO setup? It's free and very effective.

http://www.jrsoftware.org

Kevin
0
 

Author Comment

by:pedro_arzac
ID: 17956712

I`m using the standar installer of vb6, And what I need is to have some registry in windows of my program and the version of it.

I don`t know if I can do this with code.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB6 / DAO 3.6 / run time error: Couldn't find installable ISAM 7 76
VB6 Compile Compatibility Issue 4 90
using Access 8 59
vb6 connector to mongodb 2 50
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now