Create outlook object results in annoying Outlook icon flash on taskbar

  • Thread starter Thread starter -mhd
  • Start date Start date
M

-mhd

My VB application has an irritating momentary loss of focus when it
creates an Outlook object due to the brief appearance of the Outlook
taskbar icon stealing focus.

Has anyone found a workaround to this irritant?

Thanks for any relief offered.
-mhd
 
Ken Slovak said:
I haven't noticed it, show some of your code. What version of Outlook?

Perhaps it doesn't happen if you have all the MS Office background
stuff loading when you boot up but I have removed all that to keep
background tasks to a minimum when I start my system. Do you think
this why you haven't noticed it?

XP Home
Outlook 2002


Set oObject = CreateObject("Outlook.Application")
If oObject Is Nothing Then
MsgBox "Outlook Not Installed"
Exit Sub
End If

Dim NS As Object
Set NS = oObject.GetNamespace("MAPI")
NS.Logon

'Check for preferred folders
If LenB(myEntryID) = 0 Then
' Get default Contacts folder
Set myFolder = NS.GetDefaultFolder(10)
Else
' set contact folder to saved preference
Set myFolder = NS.GetFolderFromID(myEntryID, myStoreID)
End If

If UseFolderTree Then
FolderSearch myFolder, cFolders
Else
cFolders.Add myFolder
End If

Set myFolder = Nothing
==================

-mhd
 
So you are starting Outlook with your code instead of with the UI? Do you
want to display a UI at all? If so just display an Explorer.
 
Ken Slovak said:
So you are starting Outlook with your code instead of with the UI? Do you
want to display a UI at all? If so just display an Explorer.

I have to assume Outlook isn't running when my program starts since my
telephony application is usually in the startup group. Also my code
does not run the Outlook GUI, it just connects using an Outlook
object.

However you gave me the idea of starting Outlook manually to see what
happens, and it did not cause the loss of focus flash when my app
started.

So is there a way to prevent Outlook briefly showing a taskbar icon
when my app connects, or is there a way to force my VB6 app to never
lose focus until I tell it it's now OK to behave normally?

-mhd
 
Back
Top