Link to home
Create AccountLog in
Avatar of carst
carst

asked on

Shellexecute fails without error message in Windows 7 X64

I have a vfoxpro9 application that works fine in XP but one of the necessary functions fails in Windows 7 X64

In the setup I use the code:
DECLARE INTEGER ShellExecute IN Shell32.dll integer, string, string, string, string, integer

later I use the code to open a pdf or doc file
liHandle = ShellExecute(0, 'OPEN',m.getafile,'','',1)
where getafile contains a pdf or doc file including pathing.

In researching the problem I see references to UAC and antivirus programs.  I have disabled both to no effect.  It still fails.

The intended users for the program have a mix of XP, Windows 7 (both x86 and x64 versions)

Is there a fix?  What do I need to include to make this program with many hours behind it work in all flavors of windows?
Avatar of Cyril Joudieh
Cyril Joudieh
Flag of Lebanon image

Try these:

liHandle = ShellExecute(0, 'Open',m.getafile,'','',1)

liHandle = ShellExecute(0, 'Read',m.getafile,'','',1)

I never ever had any problem with it on Vista or 7 x64.
This problem means you have no Acrobat Reader installed on W7 x 64 machines or its installation is not complete or the PDF file extension is not correctly associated to it.

Resolution:  (Re)install Adobe Acrobat Reader
I've just installed Adobe Reader X (http://www.adobe.com/products/reader/tech-specs.html) on my W7/64 machine and it works fine. Prior this installation the ShellExecute call did not work without any message (because no Adobe Reader was installed on the machine).
Avatar of carst
carst

ASKER

I verified that Acrobat Reader 9 was installed and working properly.

I have installed Acrobat Reader X.  It did not resolve the problem.

Tried the two alternatives for the shellexecute ("READ" and "OPEN");
both give the unable to find the entry point error.
Does the Adobe Reader open the file if double click it in Explorer window?
Avatar of carst

ASKER

Yes!  It did before upgrading to Reader X from Reader (
"Cannot find entry point" error message is caused by invalid spelling in DECLARE command.

Isn't it this case?

If the double click does not work now, then the Reader installation is incomplete.
BTW, what is the return value from the ShellExecute function call?
Avatar of carst

ASKER

The double click on the pdf in windows explorer works.  It is in the VFP Program that the call to shellexecute doesn't work.
Avatar of carst

ASKER

ShellExecute returns 31
Avatar of carst

ASKER

It returns 42 in XP
Avatar of carst

ASKER

I have checked and the file Name is "anyrandomfile.pdf"  and double click in windows explorer does open the file.
ASKER CERTIFIED SOLUTION
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
42 (or any value greater than 32) is correct return value.
Avatar of carst

ASKER

Thanks for sticking with this.  I guess that I also had to amend the sharing for the directories in the program once the correct sequence was established.