autosc Posted June 17, 2007 Share Posted June 17, 2007 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 ..... Link to comment Share on other sites More sharing options...
star2 Posted June 17, 2007 Share Posted June 17, 2007 search forQuery file associationswith Shell32.dll Functionscheck this link for more infofrom 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] Link to comment Share on other sites More sharing options...
autosc Posted June 17, 2007 Author Share Posted June 17, 2007 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) Link to comment Share on other sites More sharing options...
FreeFry Posted June 17, 2007 Share Posted June 17, 2007 (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 June 17, 2007 by FreeFry Link to comment Share on other sites More sharing options...
Gif Posted June 17, 2007 Share Posted June 17, 2007 A good way to identify the extension is with _pathsplit() by taking the $szExt Link to comment Share on other sites More sharing options...
FreeFry Posted June 18, 2007 Share Posted June 18, 2007 well that's not really what he wants to do.. Link to comment Share on other sites More sharing options...
FreeFry Posted June 18, 2007 Share Posted June 18, 2007 (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 June 18, 2007 by FreeFry Link to comment Share on other sites More sharing options...
autosc Posted June 19, 2007 Author Share Posted June 19, 2007 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Ûhvo(î²Ð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µ¤()¹%()¹Õ¹ Link to comment Share on other sites More sharing options...
FreeFry Posted June 19, 2007 Share Posted June 19, 2007 Well it's your choice, if you prefer using files combined with the dll call then do it. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now