Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MDI Child Form set With API

Status
Not open for further replies.

Toyman

Programmer
Jun 19, 2001
68
GB
Hi

Is there a way to change the MDIChild property of a form to true during run time.

I've tried sendmessage (xxx,WM_MDICREATE,xxx,xxx)
but doesn't work.

Thanks
Toyman Toyman
VB Programmer
cdt@icon.co.za
 

Try this...

'Write this in a module...
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long

'Extended Window Style
Public Const WS_EX_MDICHILD = &H40
Public Const GWL_EXSTYLE = (-20)


'Write this in the form that you want
'to change the MDIChild property
Private Sub Form_Load()
Dim l As Long

l = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
l = l And (WS_EX_MDICHILD)
l = SetWindowLong(Me.hwnd, GWL_STYLE, l)

End Sub

Cheers!

josan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top