Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Threading in Project Properties


Message #1 by "Charlie Hughes" <Charlie@L...> on Thu, 10 May 2001 14:51:59
You could of course have a global reference to the Security class or
do something a bit more involved if needed for other reasons.

Here is one way  (think of TheWorld as your Security World:
In a *.bas module in the activeX add
'
Public gTheWorld As TheWorld
'
Public gDoIExist As Boolean     ' does the gTheWorld object exist?
                                ' set on initialize and terminate

In the one Security module in the activeX add
'
'********************
Private Sub Class_Initialize()
    
    gDoIExist = True
    
End Sub

Then in the Operator MultiUse Class

Dim WithEvents mTheWorld As TheWorld  ' local reference to the global World

'************************
' Initialize()
'
' Set reference to TheWorld
'************************
Private Sub Class_Initialize()

    ' always  need  1 global TheWorld obj
    If Not gDoIExist Then
        Set gTheWorld = New TheWorld
    End If

    Set mTheWorld = gTheWorld
    mTheWorld.NewReference   ' this method can keep track of who's "looking at security"
				' then remove this reference when in the terminate
    
End Sub

> -----Original Message-----
> From:	Charlie Hughes [SMTP:Charlie@L...]
> Sent:	Thursday, May 10, 2001 1:13 PM
> To:	professional vb
> Subject:	[pro_vb] RE: Threading in Project Properties
> 
> Let me explain why I am asking and maybe you might some ideas.  I have an 
> ActiveX EXE running on the Server.  The clients need access to a global 
> object (Security) dimensioned in the ActiveX EXE Server.  This global 
> Security object is "Public not Creatable" and is instantiated in the 
> ActiveX EXE Server in the sub main.  There is another object (Operator) 
> that is "Multiuse".  The clients dimension this operator and call a 
> function that returns a reference to the Security object.  My goal is to 
> give the same Security object reference to all clients.  What is happening 
> is that for each client a new ActiveX EXE server is being created and so 
> they are all getting a different Security Object.  I need to fix it so 
> that only one copy of the ActiveX EXE server gets launched so all clients 
> are using the same security object.  Any ideas??
> 
> > They are for multi threading.  Keep in as of yet (to the best of my
> > knowledge) VB cannot really run multiple Threads.  It mimics it, but
> > never really does.
> > 
> > -----Original Message-----
> > From: Charlie Hughes [mailto:Charlie@L...]
> > Sent: Thursday, May 10, 2001 10:52 AM
> > To: professional vb
> > Subject: [pro_vb] Threading in Project Properties
> > 
> > 
> > Can anyone explain to me exactly what the Threading settings, in Project
> > 
> > Properties, do.  I have tried to play around with these and I cannot
> > find
> > a very explicit description of what exactly happens when you select a
> > particular setting.  Any information would be helpfull.  Thanks in
> > advance.
> > 
> 

  Return to Index