你试试 =================================================================== ' Child Form Option ExplicitDim m_oParent As frmMDIParentPrivate Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (lpDest As Any, lpSource As Any, ByVal cBytes As Long)Public Property Let Parent(lpParent As Long) Dim oParent As frmMDIParent CopyMemory oParent, lpParent, 4& Set m_oParent = oParent CopyMemory oParent, 0&, 4& End PropertyPrivate Sub mnuNew_Click() m_oParent.CreateNewDocument End SubPrivate Sub mnuClose_Click() Call Terminate End SubPrivate Sub mnuCloseAll_Click() m_oParent.CloseChildren End SubPrivate Sub mnuExit_Click() m_oParent.Terminate End SubPublic Sub Terminate() Set m_oParent = Nothing Unload Me End Sub-------------------------------------------------------------------' MDI Form Public Sub CreateNewDocument() Dim f As New frmMDIChild
f.Parent = ObjPtr(Me)
f.Show End SubPublic Sub CloseChildren() Dim i As Integer For i = (Forms.Count - 1) To 0 Step -1 If TypeOf Forms(i) Is frmMDIChild Then Forms(i).Terminate End If Next End SubPublic Sub Terminate() CloseChildren Unload Me End Sub ===================================================================
f.Parent = ObjPtr(Me) 有什么用?
Public Property Let Parent(lpParent As Long) 我这个过程看不懂 Dim oParent As frmMDIParent CopyMemory oParent, lpParent, 4& CopyMemory有什么用? Set m_oParent = oParent CopyMemory oParent, 0&, 4& End Property f.Parent = ObjPtr(Me) ObjPtr这个函数什么意思?
我在书店当中从没看过这方面的书,希望大家能帮忙,谢谢!!!
===================================================================
' Child Form
Option ExplicitDim m_oParent As frmMDIParentPrivate Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (lpDest As Any, lpSource As Any, ByVal cBytes As Long)Public Property Let Parent(lpParent As Long)
Dim oParent As frmMDIParent
CopyMemory oParent, lpParent, 4&
Set m_oParent = oParent
CopyMemory oParent, 0&, 4&
End PropertyPrivate Sub mnuNew_Click()
m_oParent.CreateNewDocument
End SubPrivate Sub mnuClose_Click()
Call Terminate
End SubPrivate Sub mnuCloseAll_Click()
m_oParent.CloseChildren
End SubPrivate Sub mnuExit_Click()
m_oParent.Terminate
End SubPublic Sub Terminate()
Set m_oParent = Nothing
Unload Me
End Sub-------------------------------------------------------------------' MDI Form
Public Sub CreateNewDocument()
Dim f As New frmMDIChild
f.Parent = ObjPtr(Me)
f.Show
End SubPublic Sub CloseChildren() Dim i As Integer
For i = (Forms.Count - 1) To 0 Step -1
If TypeOf Forms(i) Is frmMDIChild Then
Forms(i).Terminate
End If
Next
End SubPublic Sub Terminate()
CloseChildren
Unload Me
End Sub
===================================================================
Dim oParent As frmMDIParent
CopyMemory oParent, lpParent, 4& CopyMemory有什么用?
Set m_oParent = oParent
CopyMemory oParent, 0&, 4&
End Property
f.Parent = ObjPtr(Me) ObjPtr这个函数什么意思?
ObjPtr是求到对象的指针
http://www.easthot.net/download/dropdowndemo.gif
色彩下拉控件界面图
http://www.easthot.net/download/xpclrcmb.gif
XP农历控件界面图(试用版)
http://www.easthot.net/download/xpcaltrial.gif
东方万年历软件界面图
http://www.easthot.net/download/eastcal.gif以上控件与软件都在分发,软件为免费版,控件除注明外,均是演示版!
需要者请到http://www.easthot.net/论坛注册登记!