A
AHopper
When I open form "OnePGoodPack" I want to find out if an
application located at c:/winwedge/winwedge.exe is open.
If the application is open I want to close it and open it
with the right configuration
If the application is closed I want to open it. I have the
functions that will open the application with various
configurations, however if I use the code and the
application is already open it creates an error.
Below is one of the functions that can open the
application. I presently call it from the On Click event
of a command button.
Function LaunchSpiderWedge()
Dim CmdLine As String
Dim RetVal As String
Dim X As Date
' This function will launch the Wedge feeding it the
' name of a configuration file on the command line
' causing the Wedge to automatically load the config
' file and activate itself
CmdLine = "C:\winwedge\winwedge.exe
C:\winwedge\SpiderWedge.SW3"
RetVal = Shell(CmdLine)
' wait for roughly 2 seconds
' give wedge time to load and activate itself
X = Now + 0.00002
Do While Now < X
DoEvents ' allow other Windows processes to continue
Loop
' set the focus back to Access
AppActivate "Microsoft Access"
End Function
In the On Close event of a form "OnePGoodPack" I would
like to find out if an application located at
c:/winwedge/winwedge.exe is open and if it is I want to
close it.
I have the function below to close the application
however, if I run the function and the application is
already closed I get an error which freezes my application.
Function KillWedge() ' This function unloads the Wedge
from memory
Dim Chan As String
' initiate DDE channel with wedge on COM1
Chan = DDEInitiate("WinWedge", "Com1")
' send AppExit command to Wedge
DDEExecute Chan, "[AppExit]"
' close the DDE Channel
DDETerminate Chan
End Function
Thank you in advance for your help.
Allan
application located at c:/winwedge/winwedge.exe is open.
If the application is open I want to close it and open it
with the right configuration
If the application is closed I want to open it. I have the
functions that will open the application with various
configurations, however if I use the code and the
application is already open it creates an error.
Below is one of the functions that can open the
application. I presently call it from the On Click event
of a command button.
Function LaunchSpiderWedge()
Dim CmdLine As String
Dim RetVal As String
Dim X As Date
' This function will launch the Wedge feeding it the
' name of a configuration file on the command line
' causing the Wedge to automatically load the config
' file and activate itself
CmdLine = "C:\winwedge\winwedge.exe
C:\winwedge\SpiderWedge.SW3"
RetVal = Shell(CmdLine)
' wait for roughly 2 seconds
' give wedge time to load and activate itself
X = Now + 0.00002
Do While Now < X
DoEvents ' allow other Windows processes to continue
Loop
' set the focus back to Access
AppActivate "Microsoft Access"
End Function
In the On Close event of a form "OnePGoodPack" I would
like to find out if an application located at
c:/winwedge/winwedge.exe is open and if it is I want to
close it.
I have the function below to close the application
however, if I run the function and the application is
already closed I get an error which freezes my application.
Function KillWedge() ' This function unloads the Wedge
from memory
Dim Chan As String
' initiate DDE channel with wedge on COM1
Chan = DDEInitiate("WinWedge", "Com1")
' send AppExit command to Wedge
DDEExecute Chan, "[AppExit]"
' close the DDE Channel
DDETerminate Chan
End Function
Thank you in advance for your help.
Allan