Results 1 to 10 of 10

Thread: [2008] File extensions in Vista!

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Location
    Denmark
    Posts
    291

    [2008] File extensions in Vista!

    When I try to modify HKEY_CLASSES_ROOT with my program in Windows Vista to assign file types to my program, I get permission denied.

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: [2008] File extensions in Vista!

    Is it safe to assume that you are the administrator?
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Location
    Denmark
    Posts
    291

    Re: [2008] File extensions in Vista!

    Yes, I am an administrator. Want the code?

    Here you go.

    vb Code:
    1. Public Sub AssociateFile(ByVal FileType As String, Optional ByVal Extra As String = " -unknownfile", Optional ByVal TitleInContext As String = vbNullString, Optional ByVal CommandInContext As String = vbNullString, Optional ByVal CommandReferenceContext As String = vbNullString)
    2.         My.Computer.Registry.ClassesRoot.CreateSubKey(FileType).SetValue(vbNullString, FileType, Microsoft.Win32.RegistryValueKind.String)
    3.         My.Computer.Registry.ClassesRoot.CreateSubKey(FileType & "\shell\open\command").SetValue(vbNullString, Application.ExecutablePath & Extra & " vbNullString%lvbNullString ", Microsoft.Win32.RegistryValueKind.String)
    4.         If Not TitleInContext = vbNullString Then
    5.             Dim RegK As Microsoft.Win32.RegistryKey
    6.             Dim RegSK As Microsoft.Win32.RegistryKey
    7.             RegK = My.Computer.Registry.ClassesRoot.OpenSubKey(FileType, False).OpenSubKey("shell", True)
    8.             RegSK = RegK.CreateSubKey(CommandReferenceContext)
    9.             RegSK.SetValue(vbNullString, TitleInContext)
    10.             RegSK.CreateSubKey("command").SetValue(vbNullString, CommandInContext)
    11.         End If
    12.     End Sub

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2008] File extensions in Vista!

    Areas of the registry are protected from access. The HKCU is about the only allowable area to read/write, even as administrator.

    You need to add trust to your app or add some security allowences.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Location
    Denmark
    Posts
    291

    Re: [2008] File extensions in Vista!

    OK. How do I do that then? Can anyone be extremely nice and tell me? I have a deadline in 7 days.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2008] File extensions in Vista!

    You need to elevate the process and run it as an Administrator.

    One of the easiest but not the best way is to set your manifest file to require administrator level or just right click on the compiled exe and set it to run as Administrator.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Location
    Denmark
    Posts
    291

    Re: [2008] File extensions in Vista!

    Quote Originally Posted by RobDog888
    You need to elevate the process and run it as an Administrator.

    One of the easiest but not the best way is to set your manifest file to require administrator level or just right click on the compiled exe and set it to run as Administrator.
    How do I modify the manifest file?

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2008] File extensions in Vista!

    Do a Forums search.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Location
    Denmark
    Posts
    291

    Re: [2008] File extensions in Vista!

    Didn't find anything. Searched for both "Manifest" and "Vista manifest" and looked ALL posts through. Nothing to suit my needs. Even though I only searched in this forum. Should I search everywhere?

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2008] File extensions in Vista!

    First hit on my search of the forums.

    http://www.vbforums.com/showthread.php?t=482140

    Its more explained better on the microsoft site but for the short and simple it works.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width