Newsgroup: it.comp.lang.visual-basic
Titolo: Cerco API

Qualcuno sa dirmi quale API utilizzare per far rimanere sempre in primo
piano una finestra e che questa non perda il focus ( cioè se clicco su
un' eventuale finestra sottostante il focus deve rimanere sempre nella
finestra che rimane in primo piano )
Grazie anticipatamente

...


vedi se fa al caso tuo
in un modulo bas fai queste dichiarazioni
Option Explicit
' API constants declarations.
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOREDRAW = &H8
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
' API function declaration.
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
'---------------------------------------------------------------------------
----
' FUNCTION    : Window_SetAlwaysOnTop(HWND, Boolean)
' DESCRIPTION : This function will set a window "always on top".
'               WIN32 API function are called to set/unset the window
topmost.
'               The window is not resized, moved or altered in any way.
' PARAMETERS  : - hwnd: Long            Window to set alwasy on top.
'               - AlwaysOnTop: Boolean  Flag to set/unset always on top.
' RETURN      : True if the function succeded,
'               False if an error occured and the operation cannot be
performed.
' EXAMPLE     : Window_SetAlwaysOnTop Form1.hwnd, True
'---------------------------------------------------------------------------
----
Function Window_SetAlwaysOnTop(hwnd As Long, AlwaysOnTop As Boolean) As
Boolean
'Funzione per avere la Form sempre in primo piano
    If AlwaysOnTop Then
        Window_SetAlwaysOnTop = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOREDRAW Or SWP_NOSIZE Or SWP_NOMOVE)
    Else
        Window_SetAlwaysOnTop = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0,
0, SWP_NOREDRAW Or SWP_NOSIZE Or SWP_NOMOVE)
    End If
End Function
nel form:
Window_SetAlwaysOnTop Form1.hwnd, True

Tratto da MS VB Site:
Dichiarazioni: 
Public Const SWP_SHOWWINDOW = &H40
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public 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(X As Form, Y As Boolean)
   Select Case Y
      Case Is = True
	 SetWindowPos X.hwnd, HWND_TOPMOST, X.Left / Screen.TwipsPerPixelX, _
		X.Top / Screen.TwipsPerPixelY, X.Width / Screen.TwipsPerPixelX, _
		X.Height / Screen.TwipsPerPixelY, SWP_SHOWWINDOW
      Case Is = False
	 SetWindowPos X.hwnd, HWND_NOTOPMOST, X.Left / Screen.TwipsPerPixelX, _
		X.Top / Screen.TwipsPerPixelY, X.Width / Screen.TwipsPerPixelX, _
		X.Height / Screen.TwipsPerPixelY, SWP_SHOWWINDOW
   End Select
End Sub
Utilizzo: 
Sempre in primo piano: Call AlwaysOnTop(Me, True) 
Normale: Call AlwaysOnTop(Me, False) 
Le dichiarazioni incollale in un modulo standard (.bas).
Ciao,
Moreno
#sirri#@
morenosoft.com
(togliete "#" dall'indirizzo)
Moreno Sirri VB Site - 
http://www.morenosoft.com/MSVBSite/
Home Page - 
http://www.geocities.com/SiliconValley/Bridge/1414/
---------------------------------------------------------------------------
Le risposte alle tue domande le trovi sul Sito Comune di questo NewsGroup:
 
http://www.murialdo.it/it_lang_vb
---------------------------------------------------------------------------