-1

I have an application (VB.NET) with the name MainForm and other child forms without using MDI Container. The child forms are based on assign to the MainForm with Me.Owner = MainForm

When I press Alt + Tab, for switching between these form, the Windows is showing the MainForm only unless I remove Me.Owner = Nothing it's working as expected again.

I tried Call SetWindowLong on Onload function but not luck. I am still looking for the solution.

EDIT

Actually it's easy for reproduced, I created very simple project.

Simple Application

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim Form2 As New Form2
    Form2.Owner = Me ' Alt+Tab only Show Form1, not showing Form2.
    Form2.Show()
End Sub

Disable Owner property is working fine again.

Please check my teamview recording. Actually it's original form without change anything.

@Royce Your solution still not working, it's throw Win32Exception from my side.

Diep Tang
  • 37
  • 2
  • 11
  • Just for clarification, I believe what the *op* means is that it is not possible to switch back to the owner window using Alt-Tab, if the owner is set on a modeless dialog. I can confirm this is indeed the case, and provoked a similar question here: https://stackoverflow.com/questions/54854317/is-there-a-built-in-shortcut-key-for-selecting-the-owner-of-the-currently-active – glopes Feb 24 '19 at 17:46

2 Answers2

0

Try to change the ShowInTaskbar Property to True.

Sascha
  • 1,210
  • 1
  • 17
  • 33
0

Ran your example on my machine (Windows 10) and both windows showed up in my Alt-Tab menu (screenshot).

In your original program, make sure that the FormBorderStyle property of either window is not set to one of the two ToolWindow options and that ShowInTaskbar is True.

Otherwise, you might try changing the CreateParams of your second form to exclude WS_EX_TOOLWINDOW extended style bit by doing something similar to this:

Protected Overrides ReadOnly Property CreateParams() As CreateParams
    Get
        Dim cp As CreateParams = MyBase.CreateParams
        cp.ExStyle = cp.ExStyle And (Not &H80)
        Return cp
    End Get
End Property
Royce
  • 143
  • 1
  • 10
  • Thanks for your solution, it's not resolved my issue. I am using Windows 8 64 bit. My customer is using windows 7, 8 still face the problem too. I added recording. – Diep Tang Jan 04 '16 at 03:14
  • Sorry, it should have been 'And' instead of 'Or'. Does it work for you now? Also, I tried to run your example in Windows 8 compatibility mode and I was still able to see both forms, so if this doesn't work, I have absolutely no idea how to make it work for you. I recommend you try your example on another pc and see if it works there. – Royce Jan 09 '16 at 02:21
  • Yes, I tried with Windows 10 and it's working as expected. I have no idea why it's not working from my side and the Customer. I tried all your solution. Is this probably a windows bug? – Diep Tang Jan 10 '16 at 11:22
  • Probably not, though I can't be sure since I can't reproduce your bug. – Royce Jan 14 '16 at 07:30