According to MSDN fMask must be set to SEE_MASK_NOCLOSEPROCESS for hProcess to get set. I would add a test to see if it is NULL. As a side note I've always had better luck using CreateProcess Edit: This is how you do it using CreateProcess: PROCESS_INFORMATION pi = {0}; STARTUPINFO si = {0}; si.
Cb = sizeof(si); si. DwFlags = STARTF_USESHOWWINDOW; si. WShowWindow = SW_SHOW; CreateProcess( NULL, "C:\\Program Files\\Internet Explorer\\iexplore.
Exe http://www.google.com/", NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi ); Sleep(4000); TerminateProcess(pi. HProcess, 0) You should add error-checking and could query the path of the default browser using: AssocQueryString like this: AssocQueryString(0,ASSOCSTR_EXECUTABLE,"http","open", szExe, &cchExe).
According to MSDN, fMask must be set to SEE_MASK_NOCLOSEPROCESS for . HProcess to get set. I would add a test to see if it is NULL.As a side note I've always had better luck using CreateProcess.
Edit: This is how you do it using CreateProcess: PROCESS_INFORMATION pi = {0}; STARTUPINFO si = {0}; si. Cb = sizeof(si); si. DwFlags = STARTF_USESHOWWINDOW; si.
WShowWindow = SW_SHOW; CreateProcess( NULL, "C:\\Program Files\\Internet Explorer\\iexplore. Exe http://www.google.com/", NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi ); Sleep(4000); TerminateProcess(pi. HProcess, 0); You should add error-checking and could query the path of the default browser using: AssocQueryString like this: AssocQueryString(0,ASSOCSTR_EXECUTABLE,"http","open", szExe, &cchExe).
Agreed, consider CreateProcess. – Robb May 19 at 21:22 @Robb : I changed fMask to SEE_MASK_NOCLOSEPROCESS and hProcess is still NULL, also tried CreateProcess, and hProcess is still null :S – riviraz May 19 at 22:25 @riviraz - I updated to show how to do it using CreateProcess it will work unless there is an existing window already open, then it may fail. – daalbert May 19 at 23:02.
You can get more information by checking the returned hProcess (e.g. , in a debugger). Also make sure you have the SEE_MASK_NOCLOSEPROCESS flag set. But my psychic powers say: Opening an IE document doesn't necessarily create a new process.
And, if it does, it may not be the one you think it is: The process you may have created may have spawned yet another process to actually host the document. Raymond Chen mentions that about halfway down this blog post.
I tried debugging and hProcess is always null either in shellexecuteex and createprocess. – riviraz May 19 at 22:26 Which is consistent with my theory that IE isn't creating a new process to open the document. (Or that the process it launched caused another process to host the document, and the original process exits.) In other words, you can't do what you're trying to do.
– Adrian McCarthy May 20 at 16:05.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.