View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Robert Crandal Robert Crandal is offline
external usenet poster
 
Posts: 309
Default Fun with Userforms!!!!

I normally create and show a basic userform by using the following
code:

Userform1.Show ' Show the basic userfom


However, I have recently discovered a new way to display
a userform which involves using the code and definitions
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 this "ThunderDFrame" form using the following call:

UserForm1.Show (vbModeless) ' Show ThunderDFrame as modeless



So..... I was wondering if it's possible to transform the "basic" userform
style described above into the "ThunderDForm" descibed above??? I am
basically interested in toggling my userform back and forth between
the basic style and ThunderDFrame styles when the form is loaded??
I think this is possible with the Win32 API & Visual C++...so I'm wondering
if I can do it with VBA as well???

Thank you everyone!