Data Access Worldwide Knowledge Base
Article ID 2312 Article Title HOWTO: Restart Current Application Article URL http://www.dataaccess.com/kbasepublic/KBPrint.asp?ArticleID=2312 KBase Category VDF12 Date Created 05/23/2007 Last Edit Date 06/02/2007
Article Text
QUESTION:
I want to programmatically restart my application. I do not want to code the name and the path of the exe filename in a constant string.
ANSWER:
In the cApplication object (handle ghoApplication) there is a function named GetApplicationFileName. This returns the name of the application including its path. So for order.exe in the standard installation folder the returned value will be "c:\program files\visual dataflex 12.0\examples\order entry\programs\order.exe".
You can then restart the application by doing the following:
Class cMyPanel Is A Panel
Procedure RestartApplication
String sFileName
If (ghoApplication > 0) Begin
Get GetApplicationFileName Of ghoApplication To sFileName
End
If (sFileName <> "") Begin
Runprogram sFileName
End
End_Procedure
End_Class
Object oMain Is A cMyPanel
:
End_Object
Inside the object oMain there is usually a menubar with pulldowns. Add a menu option that send the message RestartApplication.
Contributed By:
Vincent Oorsprong
Company: Data Access Worldwide
email: vincent.oorsprong@dataaccess.eu
Web Site: http://www.dataaccess.eu
Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2010 Data Access Corporation. All rights reserved.
The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.