Connecting Tech Pros Worldwide Forums | Help | Site Map

On back form

Newbie
 
Join Date: Jul 2006
Posts: 3
#1: Aug 23 '06
How can I make a form to stay on back in vb6? On desktop level, or someting like this?

sashi's Avatar
Expert
 
Join Date: Jun 2006
Location: Seremban, Malaysia
Posts: 1,630
#2: Aug 23 '06

re: On back form


Hi Arapila,

pls refer to below attache code segment, take care my fren..

the code..
Expand|Select|Wrap|Line Numbers
  1. '**************************************
  2. 'Windows API/Global Declarations for :Always On Top
  3. '**************************************
  4. Declare Function SetWindowPos Lib "user32" _
  5.     (ByVal hwnd As Long, _
  6.     ByVal hWndInsertAfter As Long, _
  7.     ByVal X As Long, _
  8.     ByVal Y As Long, _
  9.     ByVal cx As Long, _
  10.     ByVal cy As Long, _
  11.     ByVal wFlags As Long) As Long
  12.  
  13. Public Sub AlwaysOnTop(myfrm As Form, SetOnTop As Boolean)
  14.  
  15.  
  16.     If SetOnTop Then
  17.         lFlag = HWND_TOPMOST
  18.     Else
  19.         lFlag = HWND_NOTOPMOST
  20.     End If
  21.     SetWindowPos myfrm.hwnd, lFlag, _
  22.     myfrm.Left / Screen.TwipsPerPixelX, _
  23.     myfrm.Top / Screen.TwipsPerPixelY, _
  24.     myfrm.Width / Screen.TwipsPerPixelX, _
  25.     myfrm.Height / Screen.TwipsPerPixelY, _
  26.     SWP_NOACTIVATE Or SWP_SHOWWINDOW
  27. End Sub
  28.  
the usage..
Expand|Select|Wrap|Line Numbers
  1. AlwaysOnTop Form1, True
  2.  
Newbie
 
Join Date: Jul 2006
Posts: 3
#3: Aug 23 '06

re: On back form


thanks, but i have this function. I search for the oposite of on top. I want to make a form to stay on back. I saw this function at desktopx, i think...
Reply