Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

W2K - finding associated filetype for current user 1

Status
Not open for further replies.

Johnomill

Technical User
Dec 19, 2001
19
NL
Hi!

I want to search in the registry in W2K for a program that is associated with ".out". I can do it in W98 but in W2K it is located under the (current) user:
HKEY_USERS\<encrypted uservalue>\software\...\FileExts

I know how to get my computername and username, but how do i get the encrypted value???

Regards,

John
 
not sure if this works with 2000 but...

Code:
Const MAX_FILENAME_LEN = 260
Private Declare Function FindExecutable Lib &quot;shell32.dll&quot; Alias &quot;FindExecutableA&quot; (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long
Private Sub Form_Load()
    'KPD-Team 1999
    'URL: [URL unfurl="true"]http://www.allapi.net/[/URL]
    'E-Mail: KPDTeam@Allapi.net
   Dim i As Integer, s2 As String
   Const sFile = &quot;C:\Windows\Readme.txt&quot;

   'Check if the file exists
   If Dir(sFile) = &quot;&quot; Or sFile = &quot;&quot; Then
        MsgBox &quot;File not found!&quot;, vbCritical
        Exit Sub
   End If
   'Create a buffer
   s2 = String(MAX_FILENAME_LEN, 32)
   'Retrieve the name and handle of the executable, associated with this file
   i = FindExecutable(sFile, vbNullString, s2)
   If i > 32 Then
      MsgBox Left$(s2, InStr(s2, Chr$(0)) - 1)
   Else
      MsgBox &quot;No association found !&quot;
   End If
End Sub
 
i made some small addition to the code. I create a dummyfile with the extention i need.

f = FreeFile
Open &quot;C:\a.<extention you want>&quot; For Output as #f
Print #f, &quot;&quot;
Close #f

in code in previous message:
Const sFile = &quot;C:\a.<extention you want>&quot;

After finding the executable i delete the dummyfile with the filescripting object.

Greetings,

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top