Re: FindExecutable on Windows CE
- From: "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com>
- Date: Mon, 31 Jul 2006 09:37:57 -0700
I'm simply saying that it's not a perfect way. Acrobat would probably
associate with PDF, but another program could easily replace that and a hard
reset would likely remove it entirely (unless Acrobat was in ROM). You
simply need to be aware that your ability to tell whether Acrobat is
installed is imperfect (unless Acrobat creates registry keys unique to
itself elsewhere).
Paul T.
<ajay.sonawane@xxxxxxxxx> wrote in message
news:1154323309.354783.147000@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
So you meant to say that it will work great, but this is not the right
way to find whether acrobat is installed or not. So let me know what is
the best way to do so ,
Thanks !
-AJay
Paul G. Tobey [eMVP] wrote:
That's likely to work in most cases, but it certainly does *not* prove
that
a particular application is installed, just that something is associated
with .PDF files. If that's enough for you, go for it.
I'm not going to proof your code. If it works, great. If not, tell us
what
goes wrong.
Paul T.
<ajay.sonawane@xxxxxxxxx> wrote in message
news:1154000548.777634.59390@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Here is my code , let me know your suggestions.
BOOL IsAcrobatInstalled()
{
// Open HKLM\.pdf
HKEY hKeyPdfFile;
if ( ERROR_SUCCESS !=
RegOpenKeyEx(HKEY_CLASSES_ROOT,PDFFILE_KEY,0,0,&hKeyPdfFile))
{
fwprintf(stderr,_T("\nError in opeing key:%S"),PDFFILE_KEY);
return FALSE;
}
// Get value of default ( i.e. pdffile)
DWORD dwLength = 1024;
DWORD dwType;
TCHAR szPdfFileKeyData[1024]={'\0'};
if(ERROR_SUCCESS !=
RegQueryValueEx(hKeyPdfFile,NULL,NULL,&dwType,(LPBYTE)szPdfFileKeyData,&dwLength))
{
fwprintf(stderr,_T("\nError in RegQueryValueEx :%S"),PDFFILE_KEY);
return FALSE;
}
// form key ( HKLM\pdffile\shell\open\command )
TCHAR szKey [1024] = {'\0'};
_tcscpy(szKey,szPdfFileKeyData);
_tcscat(szKey,PDFREADER_KEY);
dwLength = 1024;
dwType = 0;
HKEY hKeyPdfReader;
// Open key HKLM\pdffile\shell\open\command
if ( ERROR_SUCCESS !=
RegOpenKeyEx(HKEY_CLASSES_ROOT,szKey,0,0,&hKeyPdfReader))
{
fwprintf(stderr,_T("\nError in RegQueryValueEx :%S"),szKey);
return FALSE;
}
TCHAR szLauncher[1024]={'\0'};
// Get value of default ( It should be exe name of application that is
associated with .pdf file)
if(ERROR_SUCCESS !=
RegQueryValueEx(hKeyPdfReader,NULL,NULL,&dwType,(LPBYTE)szLauncher,&dwLength))
{
fwprintf(stderr,_T("\nError in RegQueryValueEx :%S"),szKey);
return FALSE;
}
fwprintf(stderr,_T("\nLauncher:%S"),szLauncher);
if(_tcslen(szLauncher) == 0)
return FALSE;
return TRUE;
}
ajay.sonawane@xxxxxxxxx wrote:
Paul G. Tobey [eMVP] wrote:
OK. Well, since I just wanted to see if *something* was associated
with
*.pdf, I'd just go looking for the entry in the registry associating
with something. That's going to be at:
[HKEY_CLASSES_ROOT\.pdf]
@="<something>"
[HKEY_CLASSES_ROOT\<something>\Shell\Open\Command]
@="\"<launchpath>" %1"
So, you could go looking for <launchpath> or just verify that some
association with .pdf is there. Note that <launchpath> needent be
there.
The EXE itself might just be listed and the path might be assumed to
contain
it. As I said, I'd just check for the association and not look for
the
path
itself.
Paul T.
<ajay.sonawane@xxxxxxxxx> wrote in message
news:1153912315.518699.258830@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Paul G. Tobey [eMVP] wrote:
You want to decide what application is associated with a given
file
type?
I
suppose that you could parse the registry keys yourself to see
what's
associated, if anything. Why are you doing this? If it's just
to
decide
what program to run, just call ShellExecuteEx() to launch the
document
and
the system will choose the right application.
Paul T.
<ajay.sonawane@xxxxxxxxx> wrote in message
news:1153815846.937176.169970@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello all,
I want to find executable of any type of file. On windows , we
do
the
same thing using FindExecutabel function, How can I do it on
Windows CE
? It seems that FindExecutable is not supported on Windows CE.
Thanks.
-AJay
I need the full path of the application that is associated with
the
file.
I will try to explain what I want to achieve, I need to check
whether
acrobat reader or pdfviewer is installed on the Windows CE device.
One
way to do this is create one temporary pdf file and find the
executable
associated with it ( using FindExecutable or . I am following the
same
approach.
Registry gives me the exe name ( pdfviewer.exe %1) and not the
full
path, Can you shed some more light on this ?
OK, So I need to check only association with .pdf file, If there is a
key .pdf under HKCR, it means acrobat or pdfviewer is installed there,
No need to go to find launchpad or no need to check value of
association. Correct me if I am wrong.
.
- References:
- FindExecutable on Windows CE
- From: ajay . sonawane
- Re: FindExecutable on Windows CE
- From: Paul G. Tobey [eMVP]
- Re: FindExecutable on Windows CE
- From: ajay . sonawane
- Re: FindExecutable on Windows CE
- From: Paul G. Tobey [eMVP]
- Re: FindExecutable on Windows CE
- From: ajay . sonawane
- Re: FindExecutable on Windows CE
- From: ajay . sonawane
- Re: FindExecutable on Windows CE
- From: Paul G. Tobey [eMVP]
- Re: FindExecutable on Windows CE
- From: ajay . sonawane
- FindExecutable on Windows CE
- Prev by Date: Re: WMI equiv for PPC ...
- Next by Date: Philosophical question for handling Graphics objects
- Previous by thread: Re: FindExecutable on Windows CE
- Next by thread: Re: Socket connection and ActiveSync
- Index(es):
Relevant Pages
|