当我将其设置为On Top时,Windows 10最小化程序

时间:2016-10-05 01:26:18

标签: vb6 windows-10

这可以在两个Windows 10系统上预期(在VM上,另一个是在线PC上)。但是在第三个系统(不幸的是客户)上,形式最小化而不是最顶层。

SetwindowPos (TargetForm.hwnd, HWND_TOP,0,0,0,0, SWP_NOMOVE Or SWP_NOSIZE)

表单(窗口)最小化

知道会导致什么原因吗?

这是一个VB6程序(不要笑!,我在这个程序上谋生:)

更新:

有关代码的更多详细信息:

Set FormActive = frmToShow
frmToShow.Show
FormZorderSet frmToShow, Z_top

If Not frmPrevious Is Nothing Then
frmPrevious.Hide
End If

Public Function FormZorderSet(frmTarget As Form, Zorder As FormZorderType) As Long

    FLAGS = SWP_NOMOVE Or SWP_NOSIZE
    FormZorderSet = SetWindowPos(frmTarget.hwnd, Zorder, 0, 0, 0, 0, FLAGS)

全球宣布

  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
   Const SWP_NOSIZE = &H1
   Const SWP_NOMOVE = &H2
   Const HWND_TOPMOST = -1
   Const  HWND_TOP = 0 

1 个答案:

答案 0 :(得分:0)

尝试使用此ontop功能

'moudle code
  Option Explicit
  Public Const SWP_NOMOVE = 2
  Public Const SWP_NOSIZE = 1
  Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
  Public Const HWND_TOPMOST = -1
  Public Const HWND_NOTOPMOST = -2

  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 Function SetTopMostWindow(hwnd As Long, Topmost As Boolean) _
     As Long

     If Topmost = True Then 'Make the window topmost
        SetTopMostWindow = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, _
           0, FLAGS)
     Else
        SetTopMostWindow = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, _
           0, 0, FLAGS)
        SetTopMostWindow = False
     End If
  End Function

然后使用

'use
Dim lR As Long

Private Sub Form_Load()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'set form to allways on top
lR = SetTopMostWindow(Me.hwnd, True)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
End Sub

这在Windows 10中对我有用,但没有最小化我的程序。