Placing a form permantly in the back ground.

rowanjl
06-14-2002, 02:05 AM
How can i place a form permantly in the back ground but still let the user use it? Any help is great!!

Anis
06-14-2002, 03:23 AM
You mean that it should do processing in Background, and its invisible? Thats is what you mean?

rowanjl
06-14-2002, 03:46 AM
No i'm trying to create a program that runs on the desktop behind all other apps and still lets the user click on buttons.

ChiefRedBull
06-14-2002, 03:56 AM
But if its behind all the other apps, how will your use be able to see it to click on it?

Anis
06-14-2002, 03:57 AM
Behind all other apps.. How to click?
If its behind all application, how user will be able to click it?

rowanjl
06-14-2002, 04:10 AM
Ok i just need to make a 'Desktop' app and app that can replace the windows desktop!

ChiefRedBull
06-14-2002, 04:18 AM
You want to re-write explorer? A new windows shell? Okley dokely.... this is no mean feat, but there are examples on www.pscode.com:
http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=11819&lngWId=1 - a good one
http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=5017&lngWId=1
http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=29346&lngWId=1

And some others
http://www.shellscape.net/default.scape?go=links
http://list.shellfront.org/list.htm

A little searching goes a long way. :)

Flyguy
06-14-2002, 04:20 AM
Use the same api call when setting your form 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 Const HWND_BOTTOM = 1
Public Const HWND_TOP = 0
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2

Public Const SWP_FRAMECHANGED = &H20
Public Const SWP_HIDEWINDOW = &H80
Public Const SWP_NOACTIVATE = &H10
Public Const SWP_NOCOPYBITS = &H100
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOREDRAW = &H8
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOZORDER = &H4
Public Const SWP_SHOWWINDOW = &H40

Public Enum WindowPos
OnTop = 1
Normal = 2
OnBottom = 3
End Enum

Public Sub FormPos(hwnd As Long, wPos As WindowPos)
Select Case wPos
Case WindowPos.OnTop
SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
Case WindowPos.Normal
SetWindowPos hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
Case WindowPos.OnBottom
SetWindowPos hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
End Select
End Sub

rowanjl
06-14-2002, 04:26 AM
Thank you!!!!!!!!!!!!!!:D :D :D :D :D

rowanjl
06-14-2002, 04:39 AM
There is somethingmissing in the 'Select Case' Stat!

ChiefRedBull
06-14-2002, 07:46 AM
The forum filters out the word p-o-s (without the hyphons) because it can be used in a derogatory manner. The last part should look like this:
Public Sub FormPos(hwnd As Long, Win As WindowPos)
Select Case Win
Case WindowPos.OnTop
SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
Case WindowPos.Normal
SetWindowPos hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
Case WindowPos.OnBottom
SetWindowPos hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
End Select
End Sub

rowanjl
06-15-2002, 01:58 AM
Thanks! I have started my Desktop app.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum