View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier[_2_] Jon Peltier[_2_] is offline
external usenet poster
 
Posts: 461
Default Floating userform appears on task bar???

You don't need to call SetWindowLong when showing a form modelessly.
SetWindowLong in this case is changing the parent of the modeless form
from the Excel window to (I think) the desktop window, meaning it will
then show up on the taskbar.

Remove the SetWindowLong call, and your problem will go away.

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
http://peltiertech.com/



Robert Crandal wrote:
I am creating a special floating type of Userform using the
code and declarations below:

--------------------------------------------------------------------------------

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowLongA Lib "user32" _
(ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Private Const GWL_HWNDPARENT As Long = -8

Private Sub UserForm_Initialize()
Dim hWnd As Long
hWnd = FindWindow("ThunderDFrame", Me.Caption)
SetWindowLongA hWnd, GWL_HWNDPARENT, 0&
End Sub
-------------------------------------------------------------------------------


Then I load the form using the following call:

UserForm1.Show vbModeless

I like how this code works, but I really hate the fact that my floating
Userform
gets displayed in the Windows taskbar along with other running
applications.
Is there any way to change the code above so that my Userform dialog box
doesnt show up in the taskbar??

Thank you!