Jag får overflow när jag använder mig av denna kod. Hej! Som jag skrev så fick jag inte ovanståeende kod att fungera, så jag hittade denna kodsnutt istället:Overflow??
<code>
'Lägg I en modul:
Option Explicit
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 SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const SWP_SHOWWINDOW = &H40
Public Const SWP_NOACTIVATE = &H10
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Sub FormOnTop(Handle As Integer, OnTop As Boolean)
Dim wFlags As Long, PosFlag As Long
wFlags = SWP_NOMOVE Or SWP_NOSIZE Or _
SWP_SHOWWINDOW Or SWP_NOACTIVATE
Select Case OnTop
Case True
PosFlag = HWND_TOPMOST
Case False
PosFlag = HWND_NOTOPMOST
End Select
SetWindowPos Handle, PosFlag, 0, 0, 0, 0, wFlags
End Sub
' i form_active
FormOnTop Me.hwnd, True
</code>
Hur skall jag fixa det?
[EDIT]
Jag hittade inte felt, men väl en annan kod som fungerade.Sv: Overflow??
En gissning, parametern "Handle" till funktionen "FormOnTop" är deklarerad som Integer, borde vara Long.
/HåkanSv: Overflow??
<code>
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
Const HWND_NOTOPMOST = -2
Const HWND_TOPMOST = -1
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
</code>
Fungerar kanon.