咳咳,我可是在Win98里面也有这种现象哦,而且奇怪的是,在VB里运行程序时没有问题,但编译成可执行文件后就出现上面我说的问题啦!

解决方案 »

  1.   

    用API函数:sendmessage把窗体设在最前面!
      

  2.   

    我也做过类似的程序(隐藏的),但没发现你出现的情况,隐藏我用的是一个控件(程序员大本营中的),你也许可以试一下,my email:[email protected]
      

  3.   

    我考,还不让我up啦?CSDN真蠢,你怎么就知道我要up啊,哈哈
      

  4.   

    哈哈,hhdsq(笨笨)你好好玩啊,要是down能把你的帖子往下推,我看你就会要哭的,
      

  5.   

    在点击图标后的MouseUp消息里用SetForegroundWindow就可以了.
      

  6.   

    to:gameboy999
    我试过,好像不行呀
      

  7.   

    试试这个模块吧! 好的话可要给分!Option Explicit
    '
    ' Required Win32 API Declarations
    '
    Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As Long
    Private Declare Function AttachThreadInput Lib "user32" (ByVal idAttach As Long, ByVal idAttachTo As Long, ByVal fAttach As Long) As Long
    Private Declare Function GetForegroundWindow Lib "user32" () As Long
    Private Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As Long) As Long
    Private Declare Function IsIconic Lib "user32" (ByVal hWnd As Long) As Long
    Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
    '
    ' Constants used with APIs
    '
    Private Const SW_SHOW = 5
    Private Const SW_RESTORE = 9Public Function ForceForegroundWindow(ByVal hWnd As Long) As Boolean
       Dim ThreadID1 As Long
       Dim ThreadID2 As Long
       Dim nRet As Long
       '
       ' Nothing to do if already in foreground.
       '
       If hWnd = GetForegroundWindow() Then
          ForceForegroundWindow = True
       Else
          '
          ' First need to get the thread responsible for this window,
          ' and the thread for the foreground window.
          '
          ThreadID1 = GetWindowThreadProcessId(GetForegroundWindow, ByVal 0&)
          ThreadID2 = GetWindowThreadProcessId(hWnd, ByVal 0&)
          '
          ' By sharing input state, threads share their concept of
          ' the active window.
          '
          If ThreadID1 <> ThreadID2 Then
             Call AttachThreadInput(ThreadID1, ThreadID2, True)
             nRet = SetForegroundWindow(hWnd)
             Call AttachThreadInput(ThreadID1, ThreadID2, False)
          Else
             nRet = SetForegroundWindow(hWnd)
          End If
          '
          ' Restore and repaint
          '
          If IsIconic(hWnd) Then
             Call ShowWindow(hWnd, SW_RESTORE)
          Else
             Call ShowWindow(hWnd, SW_SHOW)
          End If
          '
          ' SetForegroundWindow return accurately reflects success.
          '
          ForceForegroundWindow = CBool(nRet)
       End If
    End Function