S
stefan.sedich
Hi I am trying to open an email in outlook with the following
string command = "c:\\Program Files\\Microsoft
Office\\OFFICE11\\OUTLOOK.EXE c:\\a.msg";
StartupInfo si = new StartupInfo();
ProcessInformation pi = new ProcessInformation();
si.cb = 68; //sizeof(si);
try {
int i = CreateProcess(null, command, 0, 0, false, 0, 0,
null, si, pi);
Int32 INFINITE;
unchecked { INFINITE = (int)0xFFFFFFFF; }
IntPtr f = new IntPtr(pi.hProcess);
WaitForSingleObject(f, INFINITE);
DocumentEventHandler h = DocumentClosedEvent;
if (h != null) h(mDocumentID);
} catch (Exception e) {
Console.WriteLine(e);
}
basically i want to open the email file, wait for the user to close it
then fire an event so i know the document was closed, this works fine
for word docs, powerpoint, sometimes works for pdf, but for outlook it
doesnt, unless outlook is fully closed and i do it. I have also tried
using the System.Diagnostics.Process, with the wait, and it has the
same effect.
Has anyone got a solution to my problem i am going crazy with this and
need it solved asap. I have also tried looking at the processes on the
system and their threads and checking if any match the id processinfo
has, but to no avail.
Please if someone can help me out here it would be appreciated.
Thanks
string command = "c:\\Program Files\\Microsoft
Office\\OFFICE11\\OUTLOOK.EXE c:\\a.msg";
StartupInfo si = new StartupInfo();
ProcessInformation pi = new ProcessInformation();
si.cb = 68; //sizeof(si);
try {
int i = CreateProcess(null, command, 0, 0, false, 0, 0,
null, si, pi);
Int32 INFINITE;
unchecked { INFINITE = (int)0xFFFFFFFF; }
IntPtr f = new IntPtr(pi.hProcess);
WaitForSingleObject(f, INFINITE);
DocumentEventHandler h = DocumentClosedEvent;
if (h != null) h(mDocumentID);
} catch (Exception e) {
Console.WriteLine(e);
}
basically i want to open the email file, wait for the user to close it
then fire an event so i know the document was closed, this works fine
for word docs, powerpoint, sometimes works for pdf, but for outlook it
doesnt, unless outlook is fully closed and i do it. I have also tried
using the System.Diagnostics.Process, with the wait, and it has the
same effect.
Has anyone got a solution to my problem i am going crazy with this and
need it solved asap. I have also tried looking at the processes on the
system and their threads and checking if any match the id processinfo
has, but to no avail.
Please if someone can help me out here it would be appreciated.
Thanks