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.
StringBuilder MsgBuilder = new System.Text.StringBuilder(); MsgBuilder.Append("mailto:firstname.lastname@example.org"); MsgBuilder.Append("&email@example.com,firstname.lastname@example.org"); MsgBuilder.Append("&email@example.com,firstname.lastname@example.org"); 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.
- Moved by Helen Zhou Tuesday, July 13, 2010 2:56 AM (From:Windows Forms General)
Wednesday, July 14, 2010 7:20 AMModerator
Thank you for your post! I would suggest posting your question in one of the
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.