Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have one form1 in VB6 running in background as Me.Visible=False. It gets keyboard entry in HID mode and when in does on Text_change I and showing another form2 which has Thank You message.
All works fine but Form2 is minimized I want it to be popped out.
I googled it aid to use Me.SetFocus I have used it on both forms but No go . I tried Form1.visible= True again it remains minimized.

Please let me know what else I can try.

Thank
Posted
Comments
[no name] 20-Nov-15 1:27am    
try setting MyForm.ZORDER 0

1 solution

I am able to achieve by
VB.NET
Private Sub Form_Load()

Dim lR As Long
         lR = SetTopMostWindow(Form2.hwnd, True)

End Sub



and added a module

VB.NET
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



One can refer to https://support.microsoft.com/en-us/kb/184297

Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900