How to ensure that the MAPI client receives focus when it starts?

I have a function that launches the default user mail program through MAPI. The mail program usually runs on top of my application, but sometimes it is not; sometimes my application stays on top of the desktop display. Is there a way to ensure that a custom email program runs on top of the desktop, rather than hiding behind other open applications?

+3
source share
2 answers

you need to find the window in which you want to be on top using findwindow api and then calling setforegroundwindow api

-1
source

, ShellExecute SW_SHOWNORMAL SW_SHOW - , . mailto: - :

ShellExecute(Self.Handle, nil, '"mailto:somebody@example.com?subject=This is ' +
  'the subject&body=The message' first paragraph.%0ASecond paragraph.%0AThird ' +
  'Paragraph."', nil, nil, SW_SHOWNORMAL);

, .

-1

Source: https://habr.com/ru/post/1777777/


All Articles