LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Z order problems

In message of Tue, 4 May 2010
17:17:05 in microsoft.public.excel.programming, Walter Briscoe
writes
I run Excel 2003, Windows Vista and Internet Explorer 8.

I have a macro which quietly drives Internet Explorer.
When the macro has been waiting for a long time for a response from IE,
it does IE.Visible = True so the user can see what is happening and
displays a message for a short time with
Set sh = CreateObject("wscript.shell")
sh.Popup "Internet Explorer wait 5 seconds", 3, "Temp message"
The z order <http://en.wikipedia.org/wiki/Z_order is set
spreadsheet < popup < ie. i.e. spreadsheet under popup under ie.
(MsgBox behaves in the same way as sh.Popup.)
How do I make it,
spreadsheet < ie < popup.

More serious is that the taskbar z order seems to be set
taskbar < spreadsheet.
I have "Auto-hide the taskbar" set and struggle to see the taskbar.
How do I display the window names and their z-order positions?
How do I control the z-order across applications?


Nobody had anything to say on this.
I have not snipped above as I assume most readers will have scrapped it.

I have done some work which has NOT been successful.
I thought I would report it for reference.

With this simplified code:

Dim IE As Object

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True

IE.Visible makes an Internet Explorer window visible and GIVES IT FOCUS.

I tried code like this:

Private Declare Function SetWindowPos Lib "user32.dll" _
(ByVal hWND As Long, ByRef hWndInsertAfter As Long, _
ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, _
ByVal wFlags As Long) As Boolean

Const HWND_NOTOPMOST = -2

Dim response As Boolean
response = SetWindowPos(IE.hWND, HWND_NOTOPMOST, _
IE.Left, IE.Top, IE.Width, IE.Height, 0)

response is false; HWND_NOTOPMOST is ineffective; window geography is
controlled. I showed that with Left = Top = Width = Height = 0.

I tried
Private Declare Function GetLastError Lib "kernel32" () As Long
Dim e As Long
e = GetLastError ' Gets variable not declared.

I googled and was advised to use err.LastDllError rather than
GetLastError.
err.LastDllError was 0 and thus undiagnostic.

On SetWindowPos, I did not understand some words in
<http://msdn.microsoft.com/en-us/library/ms633545%28v=vs.85%29.aspx:
"As part of the Vista re-architecture, all services were moved off the
interactive desktop into Session 0. hwnd and window manager operations
are only effective inside a session and cross-session attempts to
manipulate the hwnd will fail. For more information, see The Windows
Vista Developer Story: Application Compatibility Cookbook."
I followed the link but found no light.

I could think of no method of restoring focus to the window with focus
before setting IE.Visible = True and have again given up. I understand
that Microsoft tries to prevent arbitrary applications taking focus.
I suppose I might try 'CreateObject("Excel.Application")' ;)

I can place and size the Excel and IE windows so they do not overlap to
avoid the problem when it matters to me.
--
Walter Briscoe
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change series plotting order without changing legend order? PatrickM Charts and Charting in Excel 6 December 2nd 09 07:43 PM
Problems with macro, setting "tab order" of unprotected cells Foxcole Excel Discussion (Misc queries) 2 May 14th 09 09:08 PM
URGENT- Form design and field tab-order problems Foxcole Excel Discussion (Misc queries) 5 March 26th 09 03:38 PM
How stop Excel file UK date order changing to US order in m.merge Roger Aldridge Excel Discussion (Misc queries) 1 October 9th 07 11:52 PM
Daily Macro to Download Data, Order and paste in order Iarla Excel Programming 1 November 17th 04 11:55 AM


All times are GMT +1. The time now is 11:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"