Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determine if a non fox program is already running
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Determine if a non fox program is already running
Miscellaneous
Thread ID:
01381705
Message ID:
01381705
Views:
98
I use code to find out if a 3rd party program is running which works fine normally. Lately the makers have placed a constantly changing form caption which throws my code off.

I use this code currently but how do I modify it similar to using "$" in browse commands. I need to know if the first 2 words are in the exe's caption.
Function icardlaunch
    * tcAskToStart if you want to pop up a messagebox to
    * ask if they want to start iCard software.  if True then ask to start.  False is auto start
    Parameter tcluse_icard_or_1320go

local luse_icard_or_1320go
luse_icard_or_1320go = tcluse_icard_or_1320go


    ****************************************************************
    *** First, find out if iCard is already running
    ****************************************************************

    Declare Integer ShellExecute In shell32.Dll ;
        INTEGER hndWin, String cAction, String cFileName, ;
        STRING cParams, String cDir, Integer nShowWin

    *** local variable for iCard or 1320 go Pro Screen Name
    Local tcwindowname

	* Is iCard or 1320go running already?
	* uses variable to determine

    If luse_icard_or_1320go = .f.
        tcwindowname = 'iCardRX'
    Else
        tcwindowname = 'Run Capture'
    Endif

    Declare Integer FindWindow In Win32Api Integer, String
    Declare Integer PostMessage In Win32Api Integer, Integer, Integer, Integer

    *** find out if iCard is already running.  If it is exit
    Local lnhwnd
    lnhwnd = findwindow(0, tcwindowname)


    *** if iCard is already running lnHwnd will be above zero
    If lnhwnd <> 0
        Return

    Else

        ****************************************************************
        *** Do they want to start iCard also?
        ****************************************************************
        If tcasktostart = .T.

            If Messagebox("Start iCard Software Also?",4 + 32 + 256,"Launch iCard Recording Software Now?") = 7

                ** if they answer NO do nothing but launch form icardsetup.scx
                Return

            Else
                ** iCard is not running, launch it
                Do iwanticardtostart In Main

            Endif

        Else
            ** iCard is not running, launch it
            Do iwanticardtostart In Main

        Endif

        * endif below from if lnHwnd <> 0
    Endif
I have searched the net for finding window names but only if you know the exact name.
Next
Reply
Map
View

Click here to load this message in the networking platform