473,324 Members | 2,313 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Process.Start() is blocking

jrm
..Net v1.1

I am trying to launch a MS Word merge document. It is linked to an Access mdb that has a parameterized query that pops up an input dialog when you open it. None of this should matter of course, but I think maybe it is causing the problem..?

I am doing this:
System.Diagnostics.Process merge_doc = new System.Diagnostics.Process();
merge_doc.StartInfo.FileName = "c:\adoc.doc";
merge_doc.Start();

The start call is blocking until I close the popup input form... ?! Even stranger is that a message loop is still running somewhere because my main application continues to run. The menu handler in which I start the process does in fact block though. Eventually control returns once I close that Access popup, like I said. I thought Start() was not supposed to block? Workarounds?

thx

---
Posted via DotNetSlackers.com
Jan 24 '07 #1
2 4661
On Tue, 23 Jan 2007 15:57:16 -0800, jrm wrote:
>.Net v1.1

I am trying to launch a MS Word merge document. It is linked
to an Access mdb that has a parameterized query that pops up
an input dialog when you open it. None of this should matter of
course, but I think maybe it is causing the problem..?

I am doing this:
System.Diagnostics.Process merge_doc = new System.Diagnostics.Process();
merge_doc.StartInfo.FileName = "c:\adoc.doc";
merge_doc.Start();
You have "\a" in your filename string, which is the ASCII BEL
character - it sounds a beep. You need to use one of the standard
alternatives:

@"c:\adoc.doc"
"c:/adoc.doc" - Windows understands unix-style paths
"c:\\adoc.doc"

I suspect that it is blocking because it is looking for a file called:
"c:%doc.doc", where % is the BEL character. It is not finding the
file and hanging. You should also look at how you are checking for
errors if not finding the target file causes a hang; maybe check that
the file exists before trying to open it.

rossum

>The start call is blocking until I close the popup input form... ?!
Even stranger is that a message loop is still running somewhere
because my main application continues to run. The menu handler in
which I start the process does in fact block though. Eventually
control returns once I close that Access popup, like I said. I thought
Start() was not supposed to block? Workarounds?

thx

---
Posted via DotNetSlackers.com
Jan 24 '07 #2
jrm
No, im sorry. That was a typo. I didnt copy the code verbatim... Yes do I have double slashes \\ in the pathname string.

I just tried to pinvoke ShellExecute() and it has the exact same behavior. Not only does it block, but it runs a message loop while doing so. Totally weirdo.

I found a workaround though. I can put the 'start adoc.doc' command in a .bat file, or pinvoke CreateProcess something like CreateProcess(.."WINWORD.EXE", "open adoc.doc"...). These do not block.
---
Posted via DotNetSlackers.com
Jan 24 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: D. Buck | last post by:
Details: MS SQL 2000 dual Intel 1.2 GHz processors. 1 GB RAM 2.1 GB dB Dynamic Memory Managment. No other apps running on this server. First question: Since I have Dynamic Memory Managment...
0
by: Stephen.Haeney | last post by:
I am deveeloping a WinForm application where I need to display a HTML page to the user. I would like to use IE to display this page then wait until they have closed the IE window before continuing...
3
by: Michael | last post by:
Dear All I have problem with my database server which running SQL server 2000. The server running very slow. The worst case, to save a record required more than 20-30 seconds. Since this...
4
by: Prince Kumar | last post by:
I joined a company recently and they have a java program which hangs (does nothing) after a while. This is no way consistent. It could succeed quite a few times and can fail a few other times....
0
by: henning.friese | last post by:
Hello NG, I'm need to write some code which creates tiff files from various document types (doc, pdf, xls). I want to do this by ShellExecuting (via System.Diagnostics.Process) the doc-files...
7
by: Bob | last post by:
Process.start("Mydoc.doc") starts Word with the file. I need to wait for Word to be closed before more code can execute in my app. How can I do this? Thanks for any help Bob
11
by: garyusenet | last post by:
For this first time today I used the System.Diagnositcs namespace to launch a program from my c# code. The program launches OK but I have something which has completely stumped me. The...
31
by: Nikos Chantziaras | last post by:
Hello. Is there a way to check if the current process has an stdin handle? In the win32 API, one can do: _eof(_fileno(stdin)) Crucial here is that the above doesn't block. Is there a...
12
by: =?Utf-8?B?ZXAu?= | last post by:
What is preferred method to start an app process and then fill in form fields? The following prog does not compile (b/c AppActivate does not have the correct param):...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.