Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Process releted .....

Status
Not open for further replies.

isaisa

Programmer
Joined
May 14, 2002
Messages
97
Location
IN
hi to all,
i am facing problem in ShellExecute function. I have invoked a java component called as FOP by running a batch file. This FOP is a third party component which takes path of XML and XSL files as a parameters and generates pdf file. I am using ShellExecute to run a batch file called as "fop.bat". After generation of pdf files my next execution is updating the database about created pdf. I am not checking the status of the ShellExecute. So it is a non blocking kind of a call. I can not use the blocking call as per the requirment of the project.

The ShellExecute is called in a loop as per the no. of requests logged in for the day for pdf generation. So there are number of times the fop.bat is getting executed. There is another component in the system which is triggered when there is an update in database after ShellExecute call, which zipps the pdf and mails it to respective customer.
In some cases, the population of data in pdf is half way and the updation occures which leads to triggering of zipping component.

I need to stop that triggering and only allow updation after complete population of pdf file. How do i do that in the existing system ??? The developed code is a singe threaded application. Is there any other SDK API which will achieve the same and indicate my appication about the complete filling of the pdf ???

Need a help urgently due to deadline ......
thanks in advance
sanjay

 
Your project sounds like it’s a mess of hacks.

>> Need a help urgently due to deadline

Just to take a wild guess at what might help you. Try using ShellExecuteEx() or even better CreateProcess(). You can use the HANDLE’s to the started Process from these APIs to block until the process completes. You would block using the WaitForSingleObject(…) API or WaitForSingleObjectEx() or even WaitForMulitpleObjects() whichever is appropriate for your... ummm… errrr… <gulp> solution [blush]


-pete
 
hi pete...
your guess is correct ... the project is a mess due to improper handover and i have to clean the shit now as a new comer to the project ....

anyway ... i am trying to get the concurrency by using threads and trying to use blocking calls in the seperate thread ... also will be handling exceptions ..... let's see ...
thanks for your suggestions .....

sanjay
 
i am facing problem in ShellExecute function. I have invoked a java component called as FOP by running a batch file. This FOP is a third party component which takes path of XML and XSL files as a parameters and generates pdf file. I am using ShellExecute to run a batch file called as &quot;fop.bat&quot;.

FOP is an Apache product and can be embeded in Java applicaitons.


I have no idea why you are using a Win32 application to run the FOP process but i see it two ways

A) You need a Win32 app
B) You don't need a Win32 app

In either case you have a choice for a better solution. The simplest is (B). In the case of (B) you just write the app as a Java app and embed FOP, your done.

In the case of (A) you could still write your own Java app that embeds FOP but then use real IPC like sockets to communicate with your Win32 app giving you much more control and removing most of the kludgified mess currently existing in your product.

Oh yeah i guess you have a (C) choice as well: EMBRACE THE HORROR [lol]

-pete
 
hi Pete,
Thanks a lot for your information.

sanjay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top