FindFileAssociation.c File Reference

#include <shlwapi.h>
#include "FindFileAssociation.h"
#include "MALLOC.h"

Include dependency graph for FindFileAssociation.c:

Go to the source code of this file.

Functions

char * FindFileAssociation (char *ptrFindStr, char *Extra)


Function Documentation

char* FindFileAssociation ( char *  ptrFindStr,
char *  Extra 
)

returns full name of application associated to a file extension example : FindFileAssociation (".sce","print"); returns "c:\programs files\scilab-5.0\wscilex.exe"

Definition at line 9 of file FindFileAssociation.c.

References MALLOC, MAX_PATH, and NULL.

Referenced by C2F().

00010 {
00011         char *ptrResult = NULL ;
00012 
00013         if ( ptrFindStr )
00014         {
00015                 char szDefault[MAX_PATH];
00016                 DWORD ccDefault = MAX_PATH;
00017                 HRESULT rc = AssocQueryString (0, ASSOCSTR_EXECUTABLE,ptrFindStr, Extra, szDefault, &ccDefault);
00018                 if (ccDefault)
00019                 {
00020                         if (rc==S_OK)
00021                         {
00022                                 ptrResult=(char*)MALLOC(sizeof(char)*(strlen(szDefault)+1));
00023                                 strcpy(ptrResult,szDefault);
00024                         }
00025                 }
00026         }
00027         return ptrResult;
00028 
00029 }

Here is the caller graph for this function:


Generated on Sun Mar 4 16:14:16 2007 for Scilab [trunk] by  doxygen 1.5.1