MAPISendMail forcing calling FWH app MODAL

MAPISendMail forcing calling FWH app MODAL

Postby Luis Krause » Thu May 31, 2007 6:45 pm

Hello all.

We have a rather ugly situation. We have an application that uses MAPISendMail() to open the composer window from the default email client on a users PC (for now lets assume this email client is Outlook).

As soon as Outlook's "composer" window (or whatever it's called) is up if I can't return to my FWH app because this window has made it in effect MODAL. I have to either finish entering the mail and send it, or cancel it to be able to return to my FWH app.

You can imagine this isn't going well with users who don't expect to be forced to send the email before being able to get back to our app. Usually the might want to look up additional info they might want to add to the email.

So the million dollar question is: can MAPISendMail() be instructed to behave MODLESS instead of forcing the calling app to remain MODAL till it's done?

I noticed (in mapi.c) that the call to mapisendmail uses GetActiveWindow() as one of it's parameters. From our app I tried doing a SetActiveWindow() to Outlook's hWnd (which I already know and I'm positive is the right one) but either SetActiveWindow() is broken and doesn't actually set the current active window (a subsecuent call to GetActiveWindow() shows that my FWH app remains the current active window, not Outlook).

I tried calling SetForegroundWindow() and BringWindowToFront() but that makes no difference either.

Any help in how to make MAPISendMail() behave nicely is very much appreciated!

Luis Krause.
"May the Source be with GNU"
User avatar
Luis Krause
 
Posts: 59
Joined: Tue Oct 11, 2005 1:39 am
Location: Vancouver, Canada

Postby Antonio Linares » Thu May 31, 2007 7:00 pm

Luis,

From the Windows API docs:

ulUIParam
[in] Parent window handle or zero, indicating that if a dialog box is displayed, it is application modal. If the ulUIParam parameter contains a parent window handle, it is of type HWND (cast to a ULONG). If no dialog box is displayed during the call, ulUIParam is ignored.

Its explained at:
http://msdn2.microsoft.com/en-us/library/ms527908.aspx

Maybe its as simple as provide it a zero :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41336
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Luis Krause » Thu May 31, 2007 7:18 pm

Antonio:

Don't know if those docs refer to a MAPI logon dlg or similar, because
passing a 0 instead of GetActiveWindow() (or even passing Outlook's hWnd) makes no difference.

Or the docs are wrong, or MS is screwing us up!

Thanks!

Luis
"May the Source be with GNU"
User avatar
Luis Krause
 
Posts: 59
Joined: Tue Oct 11, 2005 1:39 am
Location: Vancouver, Canada

Postby Luis Krause » Thu May 31, 2007 7:24 pm

Antonio:

Guess what?

If I change the default email client to Netscape Mail (without changing anything to mapi.c), it works as expected: I can go back and forth between Netscape's composer window and my FWH app!

Guess the answer is MS is screwing us up :evil:

Luis
"May the Source be with GNU"
User avatar
Luis Krause
 
Posts: 59
Joined: Tue Oct 11, 2005 1:39 am
Location: Vancouver, Canada


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 12 guests