Solved

Make window not on a top

Posted on 1999-01-20
5
165 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

763 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