Please Help!!!!!!!

I opened a file(del.txt) in wordpad using following code in java

try{

Process p = Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " +"del.txt");

}catch(Exception e){}

Can anyone add code for notify whenever uses closed the wordpad instance of that file.

[521 byte] By [Rohit_Kumara] at [2007-11-27 1:28:34]
# 1
If you add "p.waitFor();", then your thread will wait until the user terminates the WordPad program.
KathyMcDonnella at 2007-7-12 0:26:40 > top of Java-index,Core,Core APIs...
# 2

Sorry to say i tried this method but it is not seem to wok.

I tried it as

try{

Process p = Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + "del.txt");

p.waitFor();

}catch(Exception e){

System.out.println("EXIT.");

}

It is not working. Please suggest something else.

Thanking you

Rohit_Kumara at 2007-7-12 0:26:40 > top of Java-index,Core,Core APIs...
# 3

Try this:

try{

Process p = Runtime.getRuntime().exec("wordpad.exe del.txt");

p.waitFor();

} catch(Exception e) {

System.out.println("EXIT.");

}

KathyMcDonnella at 2007-7-12 0:26:40 > top of Java-index,Core,Core APIs...
# 4
It will work fine if ".txt" files are associated with wordpad but if it is associated with other (e.g. notepad) then it throws exceptionthat why i was using "rundll32 url.dll,FileProtocolHandler " + "del.txt"
Rohit_Kumara at 2007-7-12 0:26:40 > top of Java-index,Core,Core APIs...
# 5

> It will work fine if ".txt" files are associated with

> wordpad

> but if it is associated with other (e.g. notepad)

> then it throws exception

>

> that why i was using "rundll32

> url.dll,FileProtocolHandler " + "del.txt"

rundll32 "launches" the application in background, and returns immediately.

So if you use rundll32, Java CANNOT know when the application closes.

You simply CANNOT do it.

KathyMcDonnella at 2007-7-12 0:26:40 > top of Java-index,Core,Core APIs...
# 6
ohhthanks for everything
Rohit_Kumara at 2007-7-12 0:26:40 > top of Java-index,Core,Core APIs...