PDA

Click to See Complete Forum and Search --> : Program On Top


Insane Killa
Nov 30th, 1999, 09:42 AM
Does Anyone Have A Code To Keep Your Program On Top? I Mean So That When They Switch Windows Your Program Is Still In Say One Corner Or Where Ever They Left It???

Also How Would You Get An App To Search a Text File For A Certain Field It Is Looking For, As In Only Add The Text From Certain Place In The Text File???


Also How Do You Get An App To Search Your Hardrive For A Certain File?

aditya
Nov 30th, 1999, 04:47 PM
Use the following code in the form.

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

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

Private Sub Form_Load()
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS
End Sub

onerrorgoto
Nov 30th, 1999, 07:06 PM
If you would search this UBB you would have found this answer. http://www.vb-world.net/ubb/Forum1/HTML/010710.html
Serge's code give you a property, MakeOnTop, that you can set and then you don't have to mess around with SetWindowsPos.
But it uses the same code as aditya has written

------------------
On Error Goto Bed :0)
anders@zsystemdesign.se




[This message has been edited by onerrorgoto (edited 12-01-1999).]

funkheads
Nov 30th, 1999, 08:20 PM
you could also do this...a little easier than serge's code and no messing with SetWindowPos


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

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

Private Function MakeOnTop(frm as Form)
SetWindowPos frm.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS
End Function

Private Sub Form_Load()
MakeOnTop Me
End Sub


--michael

[This message has been edited by funkheads (edited 12-01-1999).]

[This message has been edited by funkheads (edited 12-01-1999).]