Solved

Make window not on a top

Posted on 1999-01-20
5
160 Views
Last Modified: 2010-05-03
How I can from VB send window from another program(which is
always on a top but not modal) to back???
0
Comment
Question by:igorshul
5 Comments
 
LVL 4

Expert Comment

by:chabaud
ID: 1469641
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_TOPMOST = &H8&

'You must pass the window handle
Public Sub SetNoTopmost(ByVal hWnd As Long)
   
    Dim wexstyle As Long
   
    wexstyle = GetWindowLong(hWnd, GWL_EXSTYLE)
    wexstyle = (wexstyle And (Not WS_EX_TOPMOST))
    SetWindowLong hWnd, GWL_EXSTYLE, wexstyle

End Sub

0
 

Author Comment

by:igorshul
ID: 1469642
This one doesn't work.
How you find window handle if this window from another program?
But even when I get window handle those functions not working...
0
 
LVL 1

Expert Comment

by:BabyFace
ID: 1469643
How did you find the window handles?
FindWindow?
If not, try FindWindow function.

0
 
LVL 3

Accepted Solution

by:
luisr earned 100 total points
ID: 1469644
Call FindWindow("window classname", "caption"). If you know the class name you can pass it as the class name, and pass NULL as the caption argument. Otherwise, pass NULL as classname and pass the window caption as the second arg.

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal szClass As String, ByVal szCaption As String) As Long

FindWindow will return the window handle, which you can pass to the SetNoTopmost() subroutine written by chebada.

0
 
LVL 1

Expert Comment

by:BabyFace
ID: 1469645
Ok,
Thanks for stealing my answer Luisr.
You're such an asshole.
What a cheap way to get your kicks.

0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now