Solved

Keeping a Form Box ALWAYS on TOP

Posted on 1998-09-29
10
170 Views
Last Modified: 2010-04-30
How do you keep a form box to always stay on top no matter what other form box my application may pop up and thus trying to be on top?
I don't mean i want my form box to have focus when you are clicking to other form boxes, i just want it to remain visible while you go about working in other boxes.
I've set my form box to modal (so as to allow any other form box of my app to run while it is up), but i can't figure out the rest.
0
Comment
Question by:ljaques
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 5

Accepted Solution

by:
chewhoung earned 20 total points
ID: 1437293
0
 

Author Comment

by:ljaques
ID: 1437294
How do you get this OCX file to work with my vb app?
I have to register it?  I noticed it had a .REG file included with the zip but i have no idea how to get it to work..
Could you provide the steps?
0
 

Expert Comment

by:ebussa
ID: 1437295
You can use Window API's to do this.  There is no OCX needed.  

To make a window "On Top" of ALL windows, try the following...

http://support.microsoft.com/support/kb/articles/q184/2/97.asp

To make a window "On Top" of a specific window, try this ...

http://www.mvps.org/vbnet/faq/form/floating.htm

0
 
LVL 5

Expert Comment

by:chewhoung
ID: 1437296
Go to Project->Components->Browse and look for the component you just install and select OK.
0
 

Author Comment

by:ljaques
ID: 1437297
chewhoung, I tried that but VB comes with a "THIS IS NOT REGISTERED" error.  It comes with a .REG file but I dont know how to install it.


0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:ljaques
ID: 1437298
chewhoung, I tried that but VB comes with a "THIS IS NOT REGISTERED" error.  It comes with a .REG file but I dont know how to install it.


0
 
LVL 5

Expert Comment

by:chewhoung
ID: 1437299
extract OCX and DEP file to windows\system dir and select file from there. I tried my one  and its OK.
0
 
LVL 14

Expert Comment

by:waty
ID: 1437300
Don't use any ocx, use the following code, it is easier and safest :

Private Declare Function SetWindowPos Lib "user32" (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

Sub AlwaysOnTop(frmID As Form, OnTop As Integer)
   ' *** Pass any non-zero value to Place on top
   ' *** Pass zero to remove top-mostness

   Const SWP_NOMOVE = 2
   Const SWP_NOSIZE = 1
   Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
   Const HWND_TOPMOST = -1
   Const HWND_NOTOPMOST = -2

   If OnTop Then
      OnTop = SetWindowPos(frmID.hWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
   Else
      OnTop = SetWindowPos(frmID.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
   End If

End Sub

0
 

Author Comment

by:ljaques
ID: 1437301
Thank you all....
0
 
LVL 14

Expert Comment

by:waty
ID: 1437302
Why did you award the ocx instead of me, I gave you a complete working version witouth any OCX???
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
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…
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…
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…

867 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

16 Experts available now in Live!

Get 1:1 Help Now