
how to open outlook new mail in foreground using activex
yeah, you are right. I get a flashing button on the
taskbar most of the times. This was my problem. Looks like
it involves too much of low level programming if i need to
get the new mail item in the foreground.
thanks a lot for the help.
Quote:
>-----Original Message-----
>Unfortunately this code will work under W2K/XP only if
you are running in the
Quote:
>same address space as Outlook or if Outlook is already a
foreground application.
Quote:
>Othewise you will only get a flashing button on the
taskbar most of the time.
Quote:
>It is even more complicated than calling
SetForegroundWindow(): you need to
Quote:
>convince Windows that your app has the right to set
foreground window of another
Quote:
>application, I usually do it using AttachThreadInput()
function.
>In Delphi:
>function ForceForegroundWindow(hWnd: THandle): BOOL;
>var
> hCurWnd: THandle;
>begin
> hCurWnd := GetForegroundWindow;
> AttachThreadInput(
> GetWindowThreadProcessId(hCurWnd, nil),
> GetCurrentThreadId, True);
> Result := SetForegroundWindow(hWnd);
> AttachThreadInput(
> GetWindowThreadProcessId(hCurWnd, nil),
> GetCurrentThreadId, False);
>end;
>Dmitry Streblechenko (MVP)
>http://www.dimastr.com/
>OutlookSpy - Outlook, CDO
>and MAPI Developer Tool
message
>> You are trying to be much too complicated here. In the
following code,
>> just add the line to display the message item.
>> Public Sub CreateMailObject()
>> On Error Resume Next
>> Set outlookApp = CreateObject
>> ("Outlook.Application")
>> Set objMailItem = outlookApp.CreateItem(0)
>> objMailItem.display '<<<----------------------
----<<<
>> End Sub
>> Hollis D. Paul [MVP - Outlook]
>> Using Virtual Access 4.52 build 277 (32-bit), Windows
2000 build 2195
>> http://search.support.microsoft.com/kb/c.asp?
FR=0&SD=TECH&LN=EN-US
Quote: