Click here to Skip to main content
16,012,223 members
Home / Discussions / C#
   

C#

 
GeneralRe: Refreshing a page at frequent intervals Pin
meeram3958-Dec-06 1:29
meeram3958-Dec-06 1:29 
GeneralRe: Refreshing a page at frequent intervals Pin
Pete O'Hanlon8-Dec-06 2:27
mvePete O'Hanlon8-Dec-06 2:27 
GeneralRe: Refreshing a page at frequent intervals Pin
meeram39511-Dec-06 23:54
meeram39511-Dec-06 23:54 
Questionethernet comm instead of serial Pin
faladrim7-Dec-06 23:09
faladrim7-Dec-06 23:09 
AnswerRe: ethernet comm instead of serial Pin
Ed.Poore7-Dec-06 23:13
Ed.Poore7-Dec-06 23:13 
GeneralRe: ethernet comm instead of serial Pin
faladrim7-Dec-06 23:21
faladrim7-Dec-06 23:21 
GeneralRe: ethernet comm instead of serial Pin
Ed.Poore8-Dec-06 7:40
Ed.Poore8-Dec-06 7:40 
QuestionPostMessage(WM_CLOSE) Pin
Dewald7-Dec-06 22:37
Dewald7-Dec-06 22:37 
I am trying to invoke and kill and instance of another application (IE Explorer in my case) from my program. System.Diagnostics.Process would have worked beautifully if I was not targeting the CF 1.0 (Aaaarrrgghhh!!!!Mad | :mad: )

So now I've resorted to using CreateProcess in coredll.dll which is a little bit more hairy but does the trick. Code looks like this:

[DllImport("coredll.dll", SetLastError=true)]<br />
static extern bool CreateProcess(String imageName, String cmdLine, IntPtr lpProcessAttributes, IntPtr lpThreadAttributes, bool boolInheritHandles, Int32 dwCreationFlags, IntPtr lpEnvironment, IntPtr lpszCurrentDir, byte[] si, ProcessInfo pi);<br />
.<br />
.<br />
.<br />
ProcessInfo pi = new ProcessInfo();<br />
byte[] si = new byte[128];<br />
bool result = CreateProcess ("iexplorer.exe", "http://www.codeproject.com", IntPtr.Zero, IntPtr.Zero, false, 0, IntPtr.Zero, IntPtr.Zero, si, pi);


ProcessInfo is a class defined as follows:
public class ProcessInfo<br />
{<br />
    public IntPtr hProcess;<br />
    public IntPtr hThread;<br />
    public Int32 ProcessId;<br />
    public Int32 ThreadId;<br />
}


All of the above works but I am stuck nw at the point where I need to kill this process. I believe TerminateProcess is not the way to go as it does not shut down the process gracefully. It seems I will have to use PostMessage to send a WM_CLOSE message to the process - which is where I'm stuck.

Could anyone help me to get past this hurdle please?
AnswerRe: PostMessage(WM_CLOSE) Pin
Luc Pattyn8-Dec-06 2:00
sitebuilderLuc Pattyn8-Dec-06 2:00 
GeneralRe: PostMessage(WM_CLOSE) Pin
Dewald8-Dec-06 3:11
Dewald8-Dec-06 3:11 
GeneralRe: PostMessage(WM_CLOSE) Pin
Luc Pattyn8-Dec-06 4:54
sitebuilderLuc Pattyn8-Dec-06 4:54 
QuestionDeterming SQL Express Instance name using C# Pin
wasife7-Dec-06 22:05
wasife7-Dec-06 22:05 
AnswerRe: Determing SQL Express Instance name using C# Pin
Ed.Poore7-Dec-06 23:14
Ed.Poore7-Dec-06 23:14 
QuestionHow to Use Sql Transactions With DataRow ? Pin
hdv2127-Dec-06 21:55
hdv2127-Dec-06 21:55 
QuestionSelect more than one subitem in ListView Pin
Sarvan AL7-Dec-06 21:16
Sarvan AL7-Dec-06 21:16 
AnswerRe: Select more than one subitem in ListView Pin
Ed.Poore7-Dec-06 23:15
Ed.Poore7-Dec-06 23:15 
QuestionException:System.IndexOutOfRangeException (Urgent) Pin
Saira Tanwir7-Dec-06 21:15
Saira Tanwir7-Dec-06 21:15 
AnswerRe: Exception:System.IndexOutOfRangeException (Urgent) Pin
chravisankar7-Dec-06 21:21
chravisankar7-Dec-06 21:21 
AnswerRe: Exception:System.IndexOutOfRangeException (Urgent) Pin
Saira Tanwir7-Dec-06 21:37
Saira Tanwir7-Dec-06 21:37 
GeneralRe: Exception:System.IndexOutOfRangeException (Urgent) Pin
chravisankar7-Dec-06 21:47
chravisankar7-Dec-06 21:47 
GeneralRe: Exception:System.IndexOutOfRangeException (Urgent) Pin
Saira Tanwir7-Dec-06 21:55
Saira Tanwir7-Dec-06 21:55 
GeneralRe: Exception:System.IndexOutOfRangeException (Urgent) Pin
chravisankar7-Dec-06 22:02
chravisankar7-Dec-06 22:02 
GeneralRe: Exception:System.IndexOutOfRangeException (Urgent) Pin
quiteSmart7-Dec-06 22:02
quiteSmart7-Dec-06 22:02 
GeneralRe: Exception:System.IndexOutOfRangeException (Urgent) Pin
Saira Tanwir7-Dec-06 22:08
Saira Tanwir7-Dec-06 22:08 
GeneralRe: Exception:System.IndexOutOfRangeException (Urgent) Pin
quiteSmart7-Dec-06 22:16
quiteSmart7-Dec-06 22:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.