Thread: MsgBox Hidden
View Single Post
  #4  
Old April 10th 07, 05:26 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default MsgBox Hidden

I don't envy your position at all. I had to deal with controlling Inspector
windows very thoroughly and during many events when I built my Picture
Attachments Wizard add-in. It wasn't fun, and I had to test a great many
implementations before I found an acceptable solution (which usually involved
timers).

Anyway, in your case I think the best approach would be to use the relevant
Win32 API call to get a handle to your dialog via it's Window Title, and
ensure that it is at the foreground after you display it. If the Inspector
insists on displaying over top of it, use a timer to fire after
Inspector_Activate maybe. You may also want to consider designing a UserForm
to mimic the Message Box, and open it modally.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Lionel H" wrote:

Eric, thanks for the reply. It will probably help sort out my next problem!
Shortly after I posted the query, I found the WindowState property of the
Inspector object. So before calling the MsgBox function I set
ActiveInspector.WindowState = olMinimised. This worked fine and I could see
the MsgBox dialog box OK. All I had to do then was restore the
ActiveInspector on receipt of the yes/no response. olHelp says nothing about
the possible values for WindowState beyond admitting their existence.
olMaximised and olMinimised are self explanatory, leaving me to guess at the
meaning of olNormalWindow. I chose to assume its use would Restore the
ActiveInspector to its position prior to minimization. It didn’t. There was a
flicker as the ActiveInspector climbed out of the task bar, flew up the
olExplorer window and disappeared off the top of the screen. The next time I
clicked the New button on the explorer, I got a minimized Inspector in the
top left hand corner of the screen. At which point I set the recovery
WindowState to olMaximised and waited for a (your) response.


"Eric Legault [MVP - Outlook]" wrote:

That's odd behaviour for a dialog! It shouldn't be happening, but the only
way to control this is via methods like SetForeGroundWindow or SetWindowPos
via the Win32 API:

SetWindowPlacement Function:
http://msdn.microsoft.com/library/en...asp?frame=true


Ads