views:

122

answers:

3

We have a VB6 application that uses a non-visible window (form) for DDE communication.

We have some clients reporting that occasionally they can see this window on their desktop.

I did a scan through the code for any visible = true or show's on the form in question, but nothing.

This about all we do with it:

Load frmDDELink
frmDDELink.stuff = stuff

We don't actually explicitly display (or explicitly not display it either).

What could cause a hidden window to be displayed on a user's desktop such that it is visible?

+1  A: 

A misbehaving app on the client's machine could do that. FindWindow() is a notoriously inaccurate API function. On top of that, all VB6 windows have the same class name. Thunder something, iirc. It might be finding your window instead of the one intended, making the wrong window visible.

Hans Passant
+2  A: 

I haven't used vb6 in a long time, but try and set the location of the form to off-screen.

Try
frmDDELink.ClientLeft = -100 frmDDELink.ClientTop = -100

Black Frog
+1 nice pragmatic solution but in VB6 it would be more like `frmDDELink.Left = -100 - frmDDELink.Width: frmDDELink.Top = -100 - frmDDELink.Height`
MarkJ
Doesn't help if users have multiple screens and one to the left of the main desktop, but maybe way larger values may work... this is certainly something to think of integrating in for the futures.
Daemonic
A: 

I like Black Frog's simple hint to set the location off-screen, and nobugz's possible explanation. I would also suggest handling the Form_Activate event and setting the form invisible again.

Private Sub Form_Activate()  
  'Log something for debugging purposes?'  
  Me.Visible = False  
End Sub  
MarkJ