Re: FindExecutable on Windows CE

Tech-Archive recommends: Fix windows errors by optimizing your registry



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 *.pdf
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.

.



Relevant Pages

  • Email Attachments - From a Directory of Files
    ... I am looking for an email routine using Microsoft Access where ... the working (Windows) directory. ... So any PDF file or DOCs put in the ...
    (microsoft.public.access.forms)
  • Re: open pdf read-only or similiar
    ... before recreating of the pdf I have to close the pdf in Acr and afterwards reopen it - which is of course very annoying. ... some of the LaTeX developers) have met with Adobe, ... Unix-type systems only, though, but the README does explain why it can't work under Windows. ... If Windows does not allow to overwrite a document currently open in another application, it is not beyond the wit of humankind to open the PDF file, render it, and the close the file so that it can be overwritten, and then watch the file and re-read when necessary. ...
    (comp.text.pdf)
  • RE: Accessing file metadata on windows XP
    ... |> When rightclicking a, for example, pdf file on windows, one normally ... you now encounter the difference between Windows ...
    (comp.lang.python)
  • Re: Advanced text search
    ... not only windows API.. ... Since windows provide a summary page under file property. ... You *can* insert keywords into a PDF using VFP code ... knowledge of the PDF file format. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: FindExecutable on Windows CE
    ... Paul T. ... you could go looking for <launchpath> or just verify that some ... Windows CE ... way to do this is create one temporary pdf file and find the ...
    (microsoft.public.windowsce.app.development)