Welcome to KORG!

This won't work as written.

You are enumerating a list of objects (registry keys representing printers). The enumeration pointer ($C) is incremented each time. When you delete a key, they all shift down a position, so this method never points to all values.

To illustrate this, put 5 coins on your desk, lined up in a row. Point to the first coin with a pen - this represents the enumeration pointer $C.

Since the pen is pointing to a coin, we remove (delete) it and move the pointer to the next position. Point to the second coin, remove the first coin, but then move the 4 remaining coins into the original location. Your pointer has now moved past the first position, where the second value now exists.

The solution is to enumerate all of the keys into an array, and then loop throuth the array to delete the values.
 Code:
Function DelPrinters()

  Dim $aPrinters[0]	; array of connections to delete
  Dim $P, $A		; pointers
  Dim $Key		; reg key
  Dim $Tmp		; tmp var
  Dim $Rv		; Return Value

  $A = -1
  $P = 0

  $Key = 'HKCU\Printers\Connections'
  $Tmp = EnumKey($Key, $P)
  If $Tmp			; at least one printer?
    While Not @ERROR 
      $A = $A + 1
      ReDim Preserve $aPrinters[$A]
      $aPrinters[$A] = $Tmp
      $P = $P + 1
      $Tmp = EnumKey($Key, $P)
    Loop

    For Each $P in $aPrinters
      'delete ' $Key '\' $P ?
      ;$Rv = DelKey($Key + '\' + $P)
    Next

  EndIf

EndFunction
Note that as shown above, it displays what it will delete without deleting. After confirming it does what you want, comment the message line and uncomment the DelKey line.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D