Solved

How to add my program to windows registry

Posted on 2006-11-15
4
127 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)
Comment Utility
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)
Comment Utility
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
Comment Utility
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
Comment Utility

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

763 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

12 Experts available now in Live!

Get 1:1 Help Now