Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Shellexecute error
Message
De
12/11/2007 18:33:05
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Shellexecute error
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01268567
Message ID:
01268567
Vues:
61
Hi all,

I have a simple routine that uses shellExecute to open a PDF file, but it fails with error code 5. Could someone tell me what could be the reason for this?
BTW this happens only one one computer (XP) logged in as administrator. Same code works well on other machines

Here's the code:
LPARAMETERS pcFilename, pnWindowState, pnhWnd

lcFilename = pcFilename
lcop = 'open'
lcparms = ""

DECLARE INTEGER ShellExecute IN Shell32;
INTEGER hWnd, STRING @lpOperation,;
STRING @lpFile, STRING @lpParameters,;
STRING @lpDirectory, INTEGER nShowCmd
lnresult = ShellExecute(0, @lcop, @lcFilename,;
@lcparms, @lcpath, lnWindowState)

IF lnresult < 33 && Error occurred
IF lnresult = 31 && No file associated
DECLARE INTEGER GetSystemDirectory IN Win32API;
STRING @lpBuffer, INTEGER nSize
lnsize = 260
lcbuffer = SPACE(lnsize)
lnsize = GetSystemDirectory(@lcbuffer, lnsize)
IF lnsize > 0
lcbuffer = LEFT(lcbuffer, lnsize)
lcrundll = "RUNDLL32.EXE"
lcparms = "shell32.dll,OpenAs_RunDLL "
lnresult = ShellExecute(lnhWnd, @lcop, lcrundll,;
lcparms + lcFilename, lcbuffer, lnWindowState)
ENDIF
ENDIF
ENDIF
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform