Jump to content

Recommended Posts

Posted

My application takes as input , extension of a file and tries to identify the launcher application .

For example, if my application receives a .doc file( as input ) then I would like to know what application opens this in the current/user/ computer.

In order to resolve , I must search file associations to identify the Launcher application ,

any hints how to .....

Posted

search for

Query file associations

with Shell32.dll Functions

check this link for more info

from here thanks to poisonkiller

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Posted

search for

Query file associations

with Shell32.dll Functions

check this link for more info

from here thanks to poisonkiller

Thanks good hints ... I came up with this ...with a known file with full path .

but i want to do it just by extension .. "doc" , "txt" ....

$sFileName ="c:\test7.doc"
$sDirectory= ""

$rBuffer = DllStructCreate("char[4096]")
DllCall("Shell32.dll", "hwnd", "FindExecutable", "str", $sFileName, "str", $sDirectory, "ptr", DllStructGetPtr($rBuffer))
  
$Returns=  DllStructGetData($rBuffer, 1)
Posted (edited)

Edit: nvm.

You could make it use only the Registry to get what you want, RegRead'ing the default value the key "HKCR\.txt" would return the associated file-type, ie. txtfile

then you RegRead the default value for the key "HKCR\txtfile\open", and you'll get what program it opens with

Edited by FreeFry
Posted (edited)

I made this little quick function, it should do what you are trying to accomplish:

Func _FindAssocExecutable($s_FileExt)
    
    If FileExists($s_FileExt) Then $s_FileExt = StringTrimLeft($s_FileExt, StringInStr($s_FileExt, ".", 0, -1)-1)
    
    Local $i_ExpandEnv = Opt("ExpandEnvStrings")
    
    Opt("ExpandEnvStrings", 1)
    
    Local $s_Ret = RegRead("HKCR\" & RegRead("HKCR\" & $s_FileExt, "") & "\shell\open\command", "")
    
    If @error Then
        SetError(1) ; RegRead failed
        Return
    EndIf
    
    $s_Ret = String($s_Ret)
    
    Opt("ExpandEnvStrings", $i_ExpandEnv)
    
    Return $s_Ret
    
EndFunc
oÝ÷ ÙKÙbëaÆ®¶­s`¢b33c´WRÒôfæD76ö4WV7WF&ÆRgV÷C²çGBgV÷C² ¤×6t&÷ÂgV÷C²çGB276ö6FVBvFgV÷C²Âb33c´WRoÝ÷ ØGb´¥²uçl¢ØZ·*.q©î±è­Â+a~)^¥«a²Ú(jëh×6
$Exe = _FindAssocExecutable(@WindowsDir & "\Media\ringout.wav")

MsgBox(0, ".wav is associated with", $Exe)
Edited by FreeFry
Posted

I made this little quick function, it should do what you are trying to accomplish:

Func _FindAssocExecutable($s_FileExt)
    
    If FileExists($s_FileExt) Then $s_FileExt = StringTrimLeft($s_FileExt, StringInStr($s_FileExt, ".", 0, -1)-1)
    
    Local $i_ExpandEnv = Opt("ExpandEnvStrings")
    
    Opt("ExpandEnvStrings", 1)
    
    Local $s_Ret = RegRead("HKCR\" & RegRead("HKCR\" & $s_FileExt, "") & "\shell\open\command", "")
    
    If @error Then
        SetError(1) ; RegRead failed
        Return
    EndIf
    
    $s_Ret = String($s_Ret)
    
    Opt("ExpandEnvStrings", $i_ExpandEnv)
    
    Return $s_Ret
    
EndFunc
oÝ÷ ÙKÙbëaÆ®¶­s`¢b33c´WRÒôfæD76ö4WV7WF&ÆRgV÷C²çGBgV÷C² ¤×6t&÷ÂgV÷C²çGB276ö6FVBvFgV÷C²Âb33c´WRoÝ÷ ØGb´¥²uçl¢ØZ·*.q©î±è­Â+a~)^¥«a²Ú(jëh×6
$Exe = _FindAssocExecutable(@WindowsDir & "\Media\ringout.wav")

MsgBox(0, ".wav is associated with", $Exe)
oÝ÷ Ûú®¢×&vzÛÚ­'«½êÚ·}ÈÁ©íyÛhv­o(î²Ðr²¥}"¶.µû«¶«²Úâpy©"ޭ謶¬r¸©¶jøuúèl»-±Êâ¦Ð'v+p¢¹,~)Þ~æz· Ë^­Æ¥·­º¹ìv*ÞrÙrªê-OvXC9d´÷k2²×¦ßm=ØÓðq5ªê-vYjYkzÛ«À´÷e43KOv³+-zmöÓÝ911    f¢ËfÉø§jWîËb¢yÞyÛ#ºË_WÆ×§²*'Ø-­ën®{-欲"j×{·Ý«­¢+ØÀÌØíáѹͥ½¸ôÅÕ½ÐíÑáÐÅÕ½Ðì)¥´ÀÌØíIÑÕɹÌ()}µå¥±áÕѱ ÀÌØíáѹͥ½¸¤((((()Õ¹}µå¥±áÕѱ ÀÌØíáѹͥ½¸¤()%9½Ð}¥±
ÉÑ ÅÕ½ÐíÑÍиÅÕ½ÐìµÀìÀÌØíáѹͥ½¸¤Q¡¸(5Í    ½à ÐÀ䨰ÅÕ½ÐíÉɽÈÅÕ½Ðì°ÅÕ½ÐìÉɽÈ
ÉÑ¥¹½IÍÑÑ¥¹µÀìÀÌØíáѹͥ½¸ÉɽÈèÅÕ½ÐìµÀìÉɽȤ)±Í((ÀÌØíÍ¥±9µôÅÕ½ÐíÑÍиÅÕ½ÐìµÀìÀÌØíáѹͥ½¸(ÀÌØíÍ¥ÉѽÉäôÅÕ½ÐìÅÕ½Ðì((ÀÌØíÉ    ÕÈô±±MÑÉÕÑ
ÉÑ ÅÕ½Ðí¡ÉlÐÀäÙtÅÕ½Ðì¤)±±
±° ÅÕ½ÐíM¡±°Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí¡Ý¹ÅÕ½Ðì°ÅÕ½Ðí¥¹áÕѱÅÕ½Ðì°ÅÕ½ÐíÍÑÈÅÕ½Ðì°ÀÌØíÍ¥±9µ°ÅÕ½ÐíÍÑÈÅÕ½Ðì°ÀÌØíÍ¥ÉѽÉä°ÅÕ½ÐíÁÑÈÅÕ½Ðì°±±MÑÉÕÑÑAÑÈ ÀÌØíÉ    ÕȤ¤(ÀÌØíIÑÕɹÌô±±MÑÉÕÑÑÑ ÀÌØíÉ  ÕȰĤ()¥±±Ñ ÀÌØíÍ¥±9µ¤()¹%()¹Õ¹

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...