Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CreateProcess Problems
Message
From
20/11/2003 22:26:36
Thomas Ganss (Online)
Main Trend
Frankfurt, Germany
 
 
To
20/11/2003 14:32:42
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00852013
Message ID:
00852197
Views:
16
This message has been marked as the solution to the initial question of the thread.
Hi Tracy,

we didn't follow the exact wording of the WIN32API.TXT -
I am sure of that, because I wondered why the ####
some parameters were changed to INTEGERS -
probably a Chr(0) with String definition would have worked as well -
when I skipped over my "inheritance".

The declare is of an old backup of a framework .vcx,
and here I am certain it hasn't changed.

I am also certain we put the program name into the commandline,
(be careful of max line length: around 110 we had a problem,
that number might be dependend on a setting of the OS),
changed the directory before the call and afterwards.
I remember that the middle 2 numbers were not zero:
I think the second was the priority of the process.

I've modified your code but not tested - and our setup doesn't
have to wait for the end of the process...
        DO DECL
	lcivansparm = " /A /M:TECHSUPPORT;SYSERROR;TMCONFIG;AIDOWN"
	lcivansapp = "c:\Program Files\IVANS\Transman\Transman.exe"
	lcivansdir = LEFT(lcivansapp,RAT("\",lcivansapp)-1)
	lcivansprg = "Transman.exe"
	CD (lcivansdir)
	SET DEFAULT TO LEFT(lcivansapp,RAT("\",lcivansapp)-1)
	IF adir(laDummy, m.lcivansprg)=1
	    * the exe has to be in the current Dir
            = RunAndWait(lcivansprg, lcivansparm, lcivansdir)
        ENDIF
	

PROCEDURE  RunAndWait (lcApp, lcCmdLine, lcdir)

	LOCAL lcStartupInfo, lcProcInfo, hProcess, ;
              lnPrio, lnIBelieve1
        lnIBelieve1 = 1   && Don't remember what that was
        lnPrio = 32 && Priority of Process=Normal
	lcStartupInfo = CHR(68) + REPLI(CHR(0), 67)
	lcProcInfo = REPLI(CHR(0), 16)
	IF CreateProcess(0, m.lcApp+" "+m.lcCmdLine+Chr(0), 0,0,;
                   m.lnIBelieve1, m.lnPrio,;
                   0, 0, @lcStartupInfo, @lcProcInfo) <> 0
                   Wait Wind "Hurray"

	ELSE
		Wait Wind "Still No Luck"
	ENDIF


PROCEDURE DECL
	DECLARE INTEGER CreateProcess IN kernel32;
	INTEGER lpAppName, STRING lpCmdLine, INTEGER lpProcAttr,;
	INTEGER lpThrAttr, INTEGER bInhHandles, INTEGER dwCrFlags,;
	INTEGER lpEnvir, INTEGER lpCurDir, ;
        STRING @lpStInfo, STRING @lpProcInfo
HTH

thomas
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform