From: David Youngblood on 13 Aug 2010 20:55 "Tom Shelton" <tom_shelton(a)comcast.invalid> wrote in message news:i4462a$96g$1(a)news.eternal-september.org... > BeeJ submitted this idea : >> These are small ActiveX EXE with no global data to speak of so having >> four in memory does not seem like too much but ... ? > > There is no such thing as global data in a activex exe. That hasn't been my experience, or are we talking about 2 different things? I made a small test to verify, and it does show that an object created from a muli-use class refers to the same public variable, while the single-use objects have their own data. David '* Test code in standard exe Private Sub Command1_Click() Dim c1 As Object, c2 As Object '* Create muli-use objects Set c1 = CreateObject("Project1.Class1") Set c2 = CreateObject("Project1.Class1") c1.foo = "Hello" c2.foo = "World" Debug.Print c1.foo & " " & c2.foo '*** Prints "World World", c1 and c2 access the same public variable Set c1 = Nothing Set c2 = Nothing '* Create single-use objects Set c1 = CreateObject("Project1.Class2") Set c2 = CreateObject("Project1.Class2") c1.foo = "Hello" c2.foo = "World" Debug.Print c1.foo & " " & c2.foo '*** Prints "Hello World", c1 and c2 each have their own data Set c1 = Nothing Set c2 = Nothing End Sub ActiveX Exe code follows, '* Module1 Public g_sFoo As String '* Class1, Instancing = MultiUse Public Property Get Foo() As String Foo = g_sFoo End Property Public Property Let Foo(ByVal sNewValue As String) g_sFoo = sNewValue End Property '* Class2 code, Instancing = SingleUse Public Property Get Foo() As String Foo = g_sFoo End Property Public Property Let Foo(ByVal sNewValue As String) g_sFoo = sNewValue End Property
First
|
Prev
|
Pages: 1 2 3 Prev: MsgBox and a pop up form Next: Read XML using VB6 DOM 4.0 with Namespaces - See Sample XML |