Excel window on top...
Excel window on top...
Excel window on top...
Excel window on top...
Excel window on top...
Excel window on top... Excel window on top... Excel window on top... Excel window on top... Excel window on top... Excel window on top... Excel window on top... Excel window on top...
Excel window on top... Excel window on top...
Excel window on top...
Go Back  Xtreme Visual Basic Talk > > > Excel window on top...


Reply
 
Thread Tools Display Modes
  #1  
Old 08-17-2011, 08:17 AM
tsalat tsalat is offline
Newcomer
 
Join Date: Aug 2011
Posts: 1
Default Excel window on top...


Hi,

i made an application in VB2010 where the application should be always on top above one specific window. Anyway i set the property of the main form to "topmost = true". The application is also writing some data to excel which is not a problem but the excel workbook is behind the main form which is on top. Is there any way to put the excel window on top above the main form?

thx, Tomas
Reply With Quote
  #2  
Old 11-15-2011, 05:28 AM
slingblade22 slingblade22 is offline
Newcomer
 
Join Date: Oct 2009
Posts: 4
Default

Hi,

One way is using P/Invoke.

Code:
        Private Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As IntPtr) As Boolean

        Private Declare Function GetForegroundWindow Lib "user32" () As IntPtr
       
        Private Declare Function BringWindowToTop Lib "user32" Alias "BringWindowToTop" (ByVal hwnd As IntPtr) As Long

        Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As IntPtr, ByVal nCmdShow As Int32) As Boolean

The other way is to use the Open Source "ManagedWinAPI" library which wraps a lot a useful P/Invoke commands

Code:
                        Dim window As New ManagedWinapi.Windows.SystemWindow(myForm)

                        ManagedWinapi.Windows.SystemWindow.ForegroundWindow = window
You can download it here: http://mwinapi.sourceforge.net/index.html#download
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Excel window on top...
Excel window on top...
Excel window on top... Excel window on top...
Excel window on top...
Excel window on top...
Excel window on top... Excel window on top... Excel window on top... Excel window on top... Excel window on top... Excel window on top... Excel window on top...
Excel window on top...
Excel window on top...
 
Excel window on top...
Excel window on top...
 
-->