Solved

How to add my program to windows registry

Posted on 2006-11-15
4
136 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month2 days, 18 hours left to enroll

621 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