We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

JvMail & Outlook Express

WRieder
WRieder asked
on
Medium Priority
942 Views
Last Modified: 2012-05-06
XP Pro III + D2007

I also used RapWare, same problem.

I create a PDF File, which I attach.

After JvMail1.SendMail a couple of problems manifest themselves:

1) On closing the OE New Message Screen, my App disappears into the Background
2) When I delete the Tempfile with Assignfile(F); erase(F); it takes a very long time to execute

I have tried with Application.BringToFront which works, but produces a lot of Flickering and with anything other than OE, for instance Thunderbird, Thunderbird disappears into the Background.

BringWindowToTop(Handle)  doesn't always keep the App on Top.

I have also tried to run the SendMail procedure in a separate Thread, but also to no avail.

The OE Interface appears to be system modal, while Thunderbird doesn't.

I think, if there were a way to run OE Non-Modal, I could cater for both, but I don't seem to find anything anywhere.

Kind Regards
Wolfgang
Comment
Watch Question

WRiederOwner

Author

Commented:
After some googling I found, that a problem with some versions of OE was that after calling a mapi send function the calling window became non-modal and disappeard  into the background. The following solution was recommended:

JvMai1.SendMail;
EnableWindow(Application.MainForm.Handle, False);

This seems to also prevent the App from disappearing into the Background.

I should maybe more clearly define my question, which actually is comprised of two parts:

1) Is it possible to make the NewMessage Popup of OE Non-Modal to prevent this annoying flickering?

2) What could cause the deletion of a File using "AssignFile(F); Erase(F)" to be so slow? The computer almost seems to "hang" for up to 25 Secs. (This is not consistent behaviour though, sometimes there is absolutely no delay)

If this is too complex for the points assigned, please indicate what you would like for a solution.

Kind Regards
Wolfgang
Owner
Commented:
I just found the solution. In JvMail I definded a public Variable like so:

CallingWindow: HWND;

In the calling Window:

JvMail1.CallingHandle := Self.Handle;

and then changed the TJvMail.SendMail procedure to use CallingHandle instead of Application.Handle
like so:

procedure TJvMail.SendMail(ShowDialog: Boolean);
var
  Flags: ULONG;
begin
  CheckLoadLib;
  CreateMapiMessage;
  try
    Flags := LogonFlags;
    if ShowDialog then
      Flags := Flags or MAPI_DIALOG;
    SaveTaskWindowsState;
    try
      ErrorCheck(FSimpleMapi.MapiSendMail(FSessionHandle, CallingHandle,
        FMapiMessage, Flags, 0));
    finally
      RestoreTaskWindowsState;
    end;
  finally
    FreeMapiMessage;
  end;
end;

Maybe someone might find this useful.

Kind Regards
Wolfgang

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.