Originally posted by VB_GOD
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
ShowWindow Me.hwnd, SW_HIDE
End Sub

lol well that is why...

first of all... your in the queryunload routine..which means hiding the form is pointless.. because it is being unloaded from memory... plus the fact that you are sending a message via api to the window (which is why .show/.hide and .visible doesn't work after you do this).. you don't need to do this... try something like this

VB Code:
  1. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  2.     if UnloadMode = vbFormControlMenu Then'X button
  3.         Cancel = True
  4.         Me.Hide
  5.     end if
  6. End Sub
this will make it so when the form is closed... if the user closed it with the X button.. it doesn't unload the form from memory.. but just hides it.. and you can get it back using the .show method of the form