Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Vista problem
Message
De
05/09/2007 14:05:24
 
 
À
31/08/2007 18:40:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Installation et configuration
Titre:
Divers
Thread ID:
01251167
Message ID:
01252540
Vues:
36
Hi Doug -
Sorry, I should have included more of the code. I always try to save space by being short but then there are more questions. Here is the complete code listing. I find if I use parameters rather than lparameters I don't get the error, but I still have a problem with Vista allowing the copy.
*******************************************************************************************
***	Program:	vistatiplauncher.prg
***	Author:		Don W. Freeman, PE
*** Pass:		
*** Return:		
***	Date:		
***	Copyright:	All rights reserved
***	Synopsis:	
********************************************************************************************
*** Original code from Doug Hennig
*** See blog at http://doughennig.blogspot.com/2007/04/elevating-tasks-in-vista.html
*	lcSystem = oUtility.GetSystemDirectory()
*	try  
*		oUtility.ShellExecute(lcSystem + 'odbcad32.exe', 'RunAs')
*		catch
*	endtry


*	lparameters tcFileName, ;
*		tcOperation, ;
*		tcWorkDir, ;
*		tcParameters
*set step on

tcFileName = "tiplauncher.exe"
tcOperation = "Open"
tcWorkDir = "C:\Program Files\DFDS\TIP\"
tcParameters = "RunAs"

local lcFileName, ;
	lcWorkDir, ;
	lcOperation, ;
	lcParameters, ;
	lnShow

if empty(tcFileName)
	return -1
endif &&empty(tcFileName)

lcFileName   = alltrim(tcFileName)
lcWorkDir    = iif(vartype(tcWorkDir) = 'C', alltrim(tcWorkDir), '')
lcOperation  = iif(vartype(tcOperation) = 'C' and not empty(tcOperation),alltrim(tcOperation), 'Open')
	
lcParameters = iif(vartype(tcParameters) = 'C', alltrim(tcParameters), '')
lnShow = iif(upper(lcOperation) = 'Print', 0, 1)

declare integer ShellExecute in SHELL32.dll ;
	integer nWinHandle, ;	&& handle of parent window
	string cOperation, ;	&& operation to perform
	string cFileName, ;		&& filename
	string cParameters, ;	&& parameters for the executable
	string cDirectory, ;	&& default directory
	integer nShowWindow		&& window state

return ShellExecute(0, lcOperation, lcFileName, lcParameters, lcWorkDir, lnShow)
and here's the file it's running.
*******************************************************************************************
***	Program:	TipLauncher.startup.prg
***	Author:		Don W. Freeman, PE
*** Pass:		Nothing
*** Return:
***	Date:
***	Copyright:	All rights reserved
***	Synopsis:	Program to update the installed Tip Manager if a newer version is available
********************************************************************************************
parameters lcParameter
clear

olddate = fdate('c:\program files\dfds\tip\tip.exe',1)
newdate = fdate('\\tpdfiles\data\dfreeman\applications\tip_application\tip.exe',1)

if newdate > olddate
	ans = messagebox("There is a newer version of TIP Manager available. " + ;
		"Would you like to copy it to your workstation now?",3)
	do case
	case ans = 6
		copy file '\\tpdfiles\data\dfreeman\applications\tip_application\tip.exe' to ;
			'c:\program files\dfds\tip\tip.exe'
	case ans = 2
		cancel
	endcase
endif

run /N "c:\program files\dfds\tip\tip.exe"
>Hi Don.
>
>>The line
>>
>>return ShellExecute(0, lcOperation, lcFileName, lcParameters, lcWorkDir, lnShow)
>>
>>produces an error that says "No parameter statement is found." Is there something needed in the EXE being called to receive a parameter? I added lparam at the beginning of it but that only produced another error.
>
>I'm not seeing that. Did you put this code into a PRG called ShellExecute? If so, I think this call to ShellExecute is running the PRG again, not the Windows API function.
>
>Doug
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform