Default email client window cannot go to front in Windows Vista Business 64bit
-
Monday, July 12, 2010 7:39 AM
I've developed a small C# application that will launch the default email client window by calling MAPISendMail API. I am facing a problem that the new launched email client window does not become in-front of other window but it's taskbar becomes flashing in orange colour for few time to alert user only. This situation happens in Windows Vista Business 64bit, I found that it works fine as expected, it becomes in-front of other window when i test it in Windows XP, Windows Vista 32bit, and Windows 7 64bit.
When i set the ForegroundLockTimeout from 200000 to 0 of registry then restart the PC, I found that the default email client window (Microsoft Outlook) does become in-front of my application window. In addition, i tried with following way to launch the default email client window but it still did not become in-front of other window in Windows Vista Business 64bit. The SetForegroundWindow Windows APIs look like does not work in Windows Vista and above because security enhancement.
Code:
StringBuilder MsgBuilder = new System.Text.StringBuilder(); MsgBuilder.Append("mailto:davidwoo1983@yahoo.com"); MsgBuilder.Append("&cc=testcc@testcc.com,testcc1@testcc.com"); MsgBuilder.Append("&bcc=testcc@testbcc.com,testcc1@testbcc.com"); MsgBuilder.Append("&subject=this is test subject"); MsgBuilder.Append("&body=this is test body"); MsgBuilder.Append("&Attach=\"c:\\mailattach.txt\""); Process myProcess = new Process(); myProcess.StartInfo.FileName = MsgBuilder.ToString(); myProcess.StartInfo.UseShellExecute = true; myProcess.StartInfo.RedirectStandardOutput = false; myProcess.Start(); SetForegroundWindow(myProcess.Handle); myProcess.Dispose();
It is great if someone help to give advice and answer my doubts:
- The default email client window can become in-front of other window in Windows Vista 32bit but not in Windows Vista 64bit, Is it a normal behaviour?
- Without changing the default configuration of registry setting of Windows (ForegroundLockTimeout ), how can i make the default email client window becomes in-front of other window (IE window, window explorer, etc which do not set to TopMost)?
Basic Information about the computer:
Window Vista Business SP1, Intel(R) Core(TM) 2 Quad CPU Q8200 @ 2.33GHz, 4GB, 64-bit OS.Related Information:
http://www.eggheadcafe.com/software/aspnet/31724323/bring-window-from-elevate.aspx
http://msdn.microsoft.com/en-us/library/Aa480152.aspx#appcomp_topic12
http://pcsupport.about.com/od/windowsxp/ht/stealingfocus02.htm
http://msdn.microsoft.com/en-us/library/aa511446.aspx#buttons
http://www.codeproject.com/KB/dotnet/Default_mail_client.aspx?msg=1676515#xx1676515xx
http://stackoverflow.com/questions/1737664/how-to-open-program-through-c-program-and-give-this-program-focus
- Moved by Helen Zhou Tuesday, July 13, 2010 2:56 AM (From:Windows Forms General)
All Replies
-
Wednesday, July 14, 2010 7:20 AMModerator
Hello
Thank you for your post! I would suggest posting your question in one of the
located here: http://social.technet.microsoft.com/Forums/en-us/itprovistaapps/threads
Have a great day!
Sudarshan shindode Tier 2 Application Support Server and Tools Online Operations Team- Proposed As Answer by sudarshans1Moderator Wednesday, July 14, 2010 7:20 AM
-
Thursday, July 15, 2010 10:48 AM
Thank you for your advice. I posted it at the suggested location to have more feedback.