i have to write a setup program for one of those
huge overbloated crm-systems the company
i am working for produces... everything works
okay and is very easy to implement with #$?"%
vb but one thing requires api knowledge... and
maybe one of you can help me since it's very
easy i think but i don't mave much time left, so...
i want to import a database into the sql-server,
m$ has a little console tool for this purpose (osql).
the setup works fine but lacks of a few things:
it should
1. be not visible (no prob...)
2. retrieve exe output and store it in a buffer (?)
3. know when the exe is finished (?)
4. ...continue :)
i know i CAN retrieve output with Pipes and i know
i CAN check if the program is finished with WaitFor...
but i've never done this before so if anyone can
paste a snipped...
wow that would be great :) thank you...
huge overbloated crm-systems the company
i am working for produces... everything works
okay and is very easy to implement with #$?"%
vb but one thing requires api knowledge... and
maybe one of you can help me since it's very
easy i think but i don't mave much time left, so...
i want to import a database into the sql-server,
m$ has a little console tool for this purpose (osql).
the setup works fine but lacks of a few things:
it should
1. be not visible (no prob...)
2. retrieve exe output and store it in a buffer (?)
3. know when the exe is finished (?)
4. ...continue :)
i know i CAN retrieve output with Pipes and i know
i CAN check if the program is finished with WaitFor...
but i've never done this before so if anyone can
paste a snipped...
wow that would be great :) thank you...
When you CreateProcess, a PROCESS_INFORMATION structure is
filled out. To wait for program termination, you do a
(timeout can be INFINITE to wait... infinitely ;)). This would however
block your thread until done. I believes pipes are also waitable
(returning when there's data to be read), so you could set up an
array with the hProcess and hReadPipe, and do WaitForMultipleObjects...
As for how to handle piping, look at iczelions tutorials, he describes
(and has source) on how to do it in one of them.
filled out. To wait for program termination, you do a
WaitForSingleObject(pi.hProcess, TIMEOUT);
(timeout can be INFINITE to wait... infinitely ;)). This would however
block your thread until done. I believes pipes are also waitable
(returning when there's data to be read), so you could set up an
array with the hProcess and hReadPipe, and do WaitForMultipleObjects...
As for how to handle piping, look at iczelions tutorials, he describes
(and has source) on how to do it in one of them.
okay, i've managed to get it working now... mh good
thing is, i don't need WaitForSingleObject because i
can check termination via pipes.readfile... bad thing:
vb doenst support threads and if i use the api's ...
you guessed it? ;) but thats not that bad... 'will solve
this one too... so however... thank you for your time.
thing is, i don't need WaitForSingleObject because i
can check termination via pipes.readfile... bad thing:
vb doenst support threads and if i use the api's ...
you guessed it? ;) but thats not that bad... 'will solve
this one too... so however... thank you for your time.
If you do the WaitForMultipleObjects, you don't need threads to
do your job. You can specify a very low timeout and in effect creating
a polling loop, still being able to handle eg messageloop and not
blocking the GUI. Well, something like that anyway... never messed
much with VB :).
do your job. You can specify a very low timeout and in effect creating
a polling loop, still being able to handle eg messageloop and not
blocking the GUI. Well, something like that anyway... never messed
much with VB :).
okay thank you... i notized waitforsingleobj accepts a
zero timeout value too so thats cool for vb. now i use
both ways, for the nested installations i'm using waitFor...
to look if a 3rd party installation is done within my setup
and for this sql thingy i'm using pipes because i have
to work with the output results... vb isn't such bad :grin:
...nah, it IS but they force my to use it... :cool:
zero timeout value too so thats cool for vb. now i use
both ways, for the nested installations i'm using waitFor...
to look if a 3rd party installation is done within my setup
and for this sql thingy i'm using pipes because i have
to work with the output results... vb isn't such bad :grin:
...nah, it IS but they force my to use it... :cool: