Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get returned value from .exe
Message
 
 
To
13/09/2006 14:22:19
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01153463
Message ID:
01153470
Views:
17
>i have a program (.exe) that return a string value. there is way to way the end of the .exe and get the value returned by this program ? If yes how ??? thanks !!!!

What language the program is written?

You may try
************************************************************
*  PROCEDURE RunShellScript()
************************************************************
*  Author............: Ambrish Trivedi
*  Project...........: Visual Collections
*  Created...........: 08/31/2005  13:14:59
*  Copyright.........: (c) Jzanus, LTD, 2005
*) Description.......:
*  Calling Samples...:
*  Parameter List....: tcCommand, tlSilentMode, tcRetVal
*  Major change list.:
procedure RunShellScript
lparameters tcCommand, tlSilentMode, tcRetVal

if empty(m.tcCommand)
	return
endif

local oShell, llError, loException, lnErrorCode
llError = .f.
try
	oShell = createobject("WScript.Shell")
catch to loException
	if m.tlSilentMode
		tcRetVal = "Run-time error: WScript.Shell Object is not Found"
	else
		=messagebox("Run-time error: WScript.Shell Object is not Found")
	endif
	llError = .t.
endtry
if m.llError <> .t.
	try
		lnErrorCode = oShell.run(m.tcCommand, 0,.t.) && SW_SHOW_HIDDEN 0,SW_SHOW_NORMAL 1,SW_SHOW_MINIMIZED 2,SW_SHOW_MAXIMIZED 3
		if m.lnErrorCode <> 0
		   tcRetVal = "Error in running shell command. Error Code: " + transform(m.lnErrorCode)
		endif   
	catch to loException
		if m.tlSilentMode
			tcRetVal = "Run-time error: WScript.Shell: " + ;
				m.tcCommand + chr(13) + chr(10) + Log_Error(m.loException)
		else
			=messagebox("Run-time error: WScript.Shell: " + m.tcCommand)
		endif
		llError = .t.
	endtry
endif
release oShell

return !m.llError
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform