Solved

Keeping a window always at the bottom

Posted on 2001-06-18
5
173 Views
Last Modified: 2010-05-02
I have an MDI application and a background form called frmBackground which I would like to be on the background at all times. My problem is: whenever I do Ctrl-Tab to move through the open windows of the app, only the window with focus is visible(which means is ahead of the background form). Every other form goes behind the background form and becomes invisible. How do I keep the background form at the bottom of the ZOrder at all times when I do Ctrl-Tab through the other forms?

Musleh
0
Comment
Question by:mfarid1
[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
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:gbaren
ID: 6204127
User the SetWindowPos() API with HWND_BOTTOM for second parameter. You'll need to call it every time you switch, though. I am not sure how HWND_DESKTOP works, try it.

Public Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Const HWND_BOTTOM = 1
Public Const HWND_DESKTOP = 0
Public Const SWP_NOACTIVATE = &H10
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOREDRAW = &H8
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOZORDER = &H4


lReturn = SetWindowPos(form1.hWnd, HWND_DESKTOP, 0,0,0,0,SWP_NOMOVE+SWP_NOSIZE+SWP_NOREDRAW+SWP_NOZORDER+SWP_NOACTIVATE)

0
 
LVL 3

Accepted Solution

by:
TheAnswerMan earned 100 total points
ID: 6204250
In every Form_Activate..

place this code

frmBackground.ZOrder Forms.Count - 2
0
 
LVL 3

Expert Comment

by:TheAnswerMan
ID: 6204272
hmm actually.. just this..

frmBackground.ZOrder 1
0
 
LVL 5

Expert Comment

by:gbaren
ID: 6204480
TAM,

What's the idea of locking the question? You should know better!

0
 

Author Comment

by:mfarid1
ID: 6206875
Thanks. The solution klugy but worked.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

734 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