|
|
我在ActiveDLL工程的类模块中写了这么一段代码,请看注释上的问题:
Public Function createFont(fontName As String, fontSize As Integer, fontEffect As w_FontEffect) As D3DXFont
Dim fontDesc As IFont
Dim w_font As New StdFont '这里创建的对象是否会在函数结束时注销掉?
w_font.Name = fontName
w_font.Size = fontSize
w_font.Bold = fontEffect.Bold
w_font.Italic = fontEffect.Italic
w_font.Strikethrough = fontEffect.Strikethrough
w_font.Underline = fontEffect.Underline
Set fontDesc = w_font
Set createFont = w_D3DX.createFont(d3d_Device, fontDesc.hFont) '这里用了Set,以后是否要Set一次Nothing?
Set fontDesc = Nothing '这句有没有必要?
End Function
问题都十分的弱 - -iii 我虽然知道局部域里的变量会在退出域的时候从内存注销掉,但是不确定在使用New和Set之后是不是也一样会注销 |
|