in eseguibile VB apro un file .xls
Public XLAPP As New excel.Application
FILEXLS = CommonDialog1.FileName
XLAPP.Workbooks.Open FILEXLS
fin qui tutto bene - vorrei che il file .xls rimanesse AlwaysOnTop anche passando il focus alla form dell'eseguibile VB - crederei di poterlo fare con queste API
' API constants declarations.
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOREDRAW = &H8
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
' API functions declarations.
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
e quindi questa function
Public Function Window_SetAlwaysOnTop(hWnd As Long, AlwaysOnTop As Boolean) As Boolean
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
ma mi serve hWnd del file .xls, e non c'è verso - non trovo il modo di recuperarlo![]()
chi mi aiuta?
sharkcloud's mail