• Welcome to Valhalla Legends Archive.
 

Stay on Top

Started by Networks, April 09, 2004, 02:12 PM

Previous topic - Next topic

Networks

How do you impliement a "stay on top" function in a VB6 Application?

K


Grok

#2
Private Function StayOnTop(ByRef TopPerson As CPerson, ByRef BottomPerson As CPerson) As True
   Do While TopPerson.Altitude <= BottomPerson.Altitude
       TopPerson.Altitude = TopPerson.Altitude + 1
       If BottomPerson.Slap(TopPerson) = REAL_HARD Then
           StayOnTop = False
           Exit Function
       End If
   Loop
   StayOnTop = True
End Function


Hope this helps.

Networks

Usage? And there is a syntax error Grok.

Spht

Quote from: Networks on April 09, 2004, 04:44 PM
Usage? And there is a syntax error Grok.

StayOnTop(Grok, Networks)

Networks

I am little confused I talking about windows here.

iago

grok's response was a joke.  Read K's, it explains what you need to know.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


K

Quote from: iago on April 09, 2004, 04:52 PM
grok's response was a joke.  Read K's, it explains what you need to know.

Although if you couldn't figure out that Grok's was a joke, good luck implementing the simple api call  ::)

Eli_1

Quote from: Networks on April 09, 2004, 04:44 PM
Usage? And there is a syntax error Grok.
More proof that people don't actually read the code the copy and paste.

Newby

#9
Quote from: Networks on April 09, 2004, 04:44 PM
Usage? And there is a syntax error Grok.
Define REAL_HARD as "With Blood" ;)

EDIT -- I totally agree. That is pathetic he didn't catch on to that.
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

Eli_1

Quote from: Newby on April 09, 2004, 07:49 PM
Quote from: Networks on April 09, 2004, 04:44 PM
Usage? And there is a syntax error Grok.
Define REAL_HARD as "With Blood" ;)

EDIT -- I totally agree. That is pathetic he didn't catch on to that.


Const REAL_HARD as String = "With Blood" '// *

;D

Fr0z3N



'**************************************
'Windows API/Global Declarations for
'Always On Top
'**************************************

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

Public Sub AlwaysOnTop(myfrm As Form, SetOnTop As Boolean)


   If SetOnTop Then
       lFlag = HWND_TOPMOST
   Else
       lFlag = HWND_NOTOPMOST
   End If
   SetWindowPos myfrm.hwnd, lFlag, _


   myfrm.Left / Screen.TwipsPerPixelX, _
   myfrm.Top / Screen.TwipsPerPixelY, _
   myfrm.Width / Screen.TwipsPerPixelX, _
   myfrm.Height / Screen.TwipsPerPixelY, _
   SWP_NOACTIVATE Or SWP_SHOWWINDOW
End Sub
'Well, if your for example in a form cal
'     led 'Form1' then you'd simply type:
AlwaysOnTop Form1, True


Eric

Quote from: Fr0z3N on April 10, 2004, 11:03 PM


'**************************************
'Windows API/Global Declarations for
'Always On Top
'**************************************

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

Public Sub AlwaysOnTop(myfrm As Form, SetOnTop As Boolean)


   If SetOnTop Then
       lFlag = HWND_TOPMOST
   Else
       lFlag = HWND_NOTOPMOST
   End If
   SetWindowPos myfrm.hwnd, lFlag, _


   myfrm.Left / Screen.TwipsPerPixelX, _
   myfrm.Top / Screen.TwipsPerPixelY, _
   myfrm.Width / Screen.TwipsPerPixelX, _
   myfrm.Height / Screen.TwipsPerPixelY, _
   SWP_NOACTIVATE Or SWP_SHOWWINDOW
End Sub
'Well, if your for example in a form cal
'     led 'Form1' then you'd simply type:
AlwaysOnTop Form1, True



I saw something nearly identical to that on pscode, but I'm sure it's just a coincidence. ;)

Spht

Quote from: LoRd[nK] on April 11, 2004, 05:14 AM
I saw something nearly identical to that on pscode, but I'm sure it's just a coincidence. ;)

He never claimed he wrote it, so you could be right.

iago

Also, how different can stay-on-top code BE?  I mean, besides Grok's :)
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*