Sign in to follow this  
Followers 0
larryc

help with fileregister

1 post in this topic

I'm trying to use the fileregister function from the FAQ (Q16) to register an extension, and I'm having trouble getting it to register my extension as the default. I'm feeling like I'm missing something obvious, but I can't figure out what I'm doing wrong.

What's happening is my script is registering my extension, but the extension will not show up as the default. If I double click a test.nom file after registering the .nom extension, I get the "Open with.." dialog.

Any help would be greatly appreciated!

My script is as follows:

#include "FileRegister.au3"


Global Const $SHCNE_ASSOCCHANGED = 0x08000000
Global Const $SHCNF_IDLIST     = 0x0000

$iconfile = @ScriptDir & "\noma shortcut.ico"

if $CmdLine[0] = 0 Then
    MsgBox(0,'Error','Usage: ' & @CRLF & @ScriptName &  ' /r :  register .nom extension' & @CRLF & @ScriptName &  ' /u :  unregister .nom extension' )
    exit
EndIf


switch $CmdLine[1]
Case '/r'
    FileRegister("nom", '"' & @AutoItExe  & '" /link "%1"', "Open Noma link",1, $iconfile, "Noma link")
    FileRegister("nom", '"' & @AutoItExe  & '" /view "%1"', "View Noma link",0, $iconfile, "Noma link")
    refresh()

Case '/u'
    FileUnRegister("nom", "Open Noma link")
    FileUnRegister("nom", "View Noma link")
    refresh()
Case '/link'
    MsgBox(0,'link','parameter is ' & $CmdLine[2])
Case '/view'
    MsgBox(0,'view','parameter is ' & $CmdLine[2])  
EndSwitch


Func refresh()
    DllCall('shell32.dll', 'none', 'SHChangeNotify', 'long', $SHCNE_ASSOCCHANGED, 'uint', $SHCNF_IDLIST, 'ptr', chr(0), 'ptr', chr(0))
EndFunc

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0