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
Solved

Make window not on a top

Posted on 1999-01-20
5
164 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

809 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