Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

SendMail called from MDI Child Form

edited April 2008 in General
I'm using RBuilder 10.07 with D7 on Windows XP. As reported to me, this
problem is specific to XP (doesn't happen on Vista), although I have not
confirmed that.

If I call the SendMail method of a TppReport object from an MDI child window
(MAPI client is MS Outlook), focus does not return to my application when I
close the email message window. It returns to the window behind my
application (next in the Z-Order, I suppose). I realize this is related to
popping up a window from a different application (Outlook, in this case),
but do you have any ideas as to how I can correct it or get around it? I
have tried various Windows API calls SetForegroundWindow, etc. to no avail.

When calling SendMail from modal dialogs, the problem isn't so blatant. At
least the application stays in the foreground, although the modal dialog is
not active.

The email report code is below...

///set email settings
rptTest.EmailSettings.ShowEmailDialog := False;
rptTest.EmailSettings.PreviewInEmailClient := True;

///initialize the email
rptTest.EmailSettings.Subject := rptTest.PrinterSetup.DocumentName;

///send the email
rptTest.SendMail;

Any help is appreciated.

Thanks,
Keith Thomspon
keith.thompson@acstechnologies.com

Comments

  • edited April 2008
    Hi Keith,

    If possible please give me the exact steps I can take using the MDI demo
    located in the \RBuilder\Demos\3. EndUser\4. MDI\... directory to recreate
    this issue on my machine. I have tried a number of scenarios and have been
    unable to see this behavior.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2008
    Thanks, Nico, for looking into this. Unfortunately, I don't have much of an
    answer. Basically, I open the MDI.dpr, set EmailSettings.Enabled to True on
    the TppReport object on the mdichild form, then, compile. If I run that
    MDI.exe on each of my three pc's, when I click the email report button I get
    this issue on two of the three. Our team testers are getting it
    consistently on their test PC's as well (mostly win xp with office 2003). I
    have Outlook XP (2002), Outlook 2003, and Outlook 2007 represented on my
    three Win XP machines, and the one machine that doesn't have this issue is
    the Outlook 2003 machine. I have recreated it on other machines with Office
    2003, however. I think it must be related somehow to a system setting,
    since I have one machine that does not have the issue. I just can't isolate
    what it is. I turned off the use Microsoft Word as email editor option in
    Outlook XP (can't be done in 2007), but that didn't make a difference. The
    only thing that is obviously different about the one PC that works is that
    it uses multiple Outlook profiles. None of my other machines do that.

    Keep in mind you must have at least two applications open when you do this.
    An unrelated application (Word, Excel, etc.) must be in the background
    behind the MDI.exe application. When you click the email report icon and
    cancel the email dialog, focus returns to the application in the background
    behind the MDI.exe window..

    I would write it off as one of those fluke Windows Z-Order issues that are
    not uncommon, but it happens so consistently that I can't get away with that
    one.

    Thanks,
    Keith Thompson


  • edited May 2008
    Hi Keith,

    We created a patch for RB 10.08 that seems to solve the issue on the
    machines in which we can recreate it. Send a small email to
    support@digital-metaphors.com requesting the patch and we will send it to
    you as soon as possible.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.