Results 1 to 2 of 2

Thread: creating a context menu for a specific file type

  1. #1

    Thread Starter
    Addicted Member cwm's Avatar
    Join Date
    Mar 2000
    Posts
    133
    how might i go about doing this?
    i've tried using vb to tell the registry but i can't get it to work, any help?
    Generic vb 5

    Private Sub WakeMyAssUp( As Boolean)
    If Then : = False
    End Sub

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    You could use my registry module (it's on my homepage) with the following code. You just have to change all the Bla's here with your own extension, also you can change the extension name and the associated file type. Content type is shown when you download something with your browser and default icon is the file path and the icon index separated with comma.

    Code:
    Declare Function SHChangeNotify Lib "shell32.dll" (ByVal wEventID As Long, ByVal uFlags As Long, ByVal dwItem1 As String, ByVal dwItem2 As String) As Long
    
    Property Let Associate_BLA(newvalue As Boolean)
        If newvalue Then
            RegVal("root\.bla\") = "blaFile"
            RegVal("root\.bla\Content Type") = "BLA file"
            RegVal("root\blaFile\") = "BLA "
            RegVal("root\blaFile\DefaultIcon") = App.path & "\" & App.EXEName & ".exe,1"
            RegVal("root\blaFile\Shell\Open\Command\") = App.path & "\" & App.EXEName & ".exe %1"
        Else
            DeleteKey "root\.bla"
            DeleteKey "root\blaFile"
        End If
            SHChangeNotify &H8000000, 0, vbNullString, vbNullString
    End Property
    Property Get Associate_BLA() As Boolean
        Associate_BLA = RegVal("root\.bla\") = "blaFile"
    End Property
    As this is a boolean property you can just switch it on and off when you like or return if it is set or not
    Code:
    if Associate_BLA=false then Associate_BLA=true
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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