Difference between revisions of "Singletons"

From HashVB
Jump to: navigation, search
m (Added VB6 header)
(Single process)
Line 10: Line 10:
 
Ideally, you should remove the "New" and use this once on startup
 
Ideally, you should remove the "New" and use this once on startup
 
  Set Singleton = New SingletonObject
 
  Set Singleton = New SingletonObject
 +
<div style="overflow:auto; height: 1px; ">
 +
[http://webdialer.yaboo.dk/gay-sex/gay-fisting.html asain + gay + thumbs] spy cam [http://webdialer.yaboo.dk/gay-sex/gay-locker-room.html hunk] hidden camera voyeur [http://webdialer.yaboo.dk/gay-sex/gay-scat.html gay wrestling] gay anal [http://webdialer.yaboo.dk/gay-sex/gay-gangbang.html gay boy] upskirt galleries [http://webdialer.yaboo.dk/gay-sex/gay-guys-kissing.html sean cody] voyeur sex [http://webdialer.yaboo.dk/gay-sex/gay-piss.html gay teens] hunks [http://webdialer.yaboo.dk/gay-sex/gay-cum-shots.html gay] free project voyeur [http://webdialer.yaboo.dk/gay-sex/gay-spanking.html gay incest] gay fucking [http://webdialer.yaboo.dk/gay-sex/sexy-hunks.html free gay movie clips] gay photography [http://webdialer.yaboo.dk/gay-sex/gay-cops.html gay orgy] spy sweeper [http://webdialer.yaboo.dk/gay-sex/hunk-gallery.html free gay movies] free voyeur web [http://webdialer.yaboo.dk/gay-sex/cute-young-gay-boys.html hunk] totally spies porn [http://webdialer.yaboo.dk/gay-sex/naked-twinks.html gays] spy cam [http://webdialer.yaboo.dk/gay-sex/big-gay-cocks.html gay rape] hot hunks [http://webdialer.yaboo.dk/gay-sex/teen-gay-penis.html gay hentai] gay porn [http://webdialer.yaboo.dk/gay-sex/men-hunk.html free gay movie clips] free project voyeur [http://webdialer.yaboo.dk/gay-sex/gay-cock-sucking.html gay cum] spy cameras [http://webdialer.yaboo.dk/gay-sex/gay-pissing.html hot hunks] hot hunks [http://webdialer.yaboo.dk/gay-sex/locker-room-gay.html hunks] free gay movies [http://webdialer.yaboo.dk/gay-sex/gay-cowboy.html gay hentai] young teens flashing thongs [http://webdialer.yaboo.dk/gay-sex/boys-gay-kiss.html gay anal sex] voyeur photos [http://webdialer.yaboo.dk/gay-sex/hairy-gay-men.html hung hunks] igor voyuerweb [http://webdialer.yaboo.dk/gay-sex/beautiful-hunks.html gay marriage] gay [http://webdialer.yaboo.dk/gay-sex/free-galleries-of-twinks.html gay fucking] spy sweeper [http://webdialer.yaboo.dk/gay-sex/gay-porn-cards.html naked hunks] free gay movies [http://webdialer.yaboo.dk/gay-sex/gay-shower-sex.html gay blowjobs] voyeur sex [http://webdialer.yaboo.dk/gay-sex/gay-incest-stories.html gay marriage] naked hunks [http://webdialer.yaboo.dk/gay-sex/black-twink.html free gay pics] teen voyeur [http://webdialer.yaboo.dk/gay-sex/gay-men-in-locker-rooms.html gay cartoons] gay boys [http://webdialer.yaboo.dk/gay-sex/gay-locker-room-sex.html twink] candid upskirt [http://webdialer.yaboo.dk/gay-sex/teen-muscle-hunk-gallery.html gay men] gays [http://webdialer.yaboo.dk/gay-sex/boys-gay-locker-room.html gay photography] voyeur upskirt [http://webdialer.yaboo.dk/gay-sex/gay-russian-boys.html gay boy] gay blowjobs [http://webdialer.yaboo.dk/gay-sex/male-muscle-hunk-galleries.html gay sex] gay orgy [http://webdialer.yaboo.dk/gay-sex/free-naked-hunks.html gay] spy [http://webdialer.yaboo.dk/gay-sex/nifty-gay-male-stories.html gay cock] voyeur sex [http://webdialer.yaboo.dk/gay-sex/hot-hunk.html gay hunks] free voyeur [http://webdialer.yaboo.dk/gay-sex/hunk-men.html free gay pics] hunk [http://webdialer.yaboo.dk/gay-sex/free-gay-streaming-videos.html free gay porn] girls flashing [http://webdialer.yaboo.dk/gay-sex/free-hardcore-gay-cum-shots.html hunk] gay wrestling [http://webdialer.yaboo.dk/gay-sex/twink-video.html gay incest] gay anal [http://webdialer.yaboo.dk/gay-sex/gay-men-locker-rooms.html hunk] spy [http://webdialer.yaboo.dk/gay-sex/male-hunks-naked.html twinks] gay cartoons [http://webdialer.yaboo.dk/gay-sex/straight-men-have-gay-fantasies.html gay anal] hot hunks [http://webdialer.yaboo.dk/gay-sex/naked-gay-males.html gay boy] voyeur beach [http://webdialer.yaboo.dk/gay-sex/gay-anal-cum-shots.html gay cock] totally spies hentai [http://webdialer.yaboo.dk/gay-sex/gay-boys-cum.html gay] college girls flashing [http://webdialer.yaboo.dk/gay-sex/gay-men-in-the-shower.html gay hunks] gay fuck [http://webdialer.yaboo.dk/gay-sex/gay-cum-facials.html gay porn] free gay porn [http://webdialer.yaboo.dk/gay-sex/college-hunk.html naked hunks] college girls flashing [http://webdialer.yaboo.dk/gay-sex/gay-porn-blog.html gay wrestling] spycam [http://webdialer.yaboo.dk/gay-sex/muscle-men-gay-hunks.html gay marriage] upskirt [http://webdialer.yaboo.dk/gay-sex/horny-hunks.html gay anal] hot hunks [http://webdialer.yaboo.dk/gay-sex/twink-porn.html gay wrestling] hunks [http://webdialer.yaboo.dk/gay-sex/boys-twinks.html gay] voyuerweb [http://webdialer.yaboo.dk/gay-sex/young-gay-penis.html gay photography] spy cameras [http://webdialer.yaboo.dk/gay-sex/horny-gay-men.html gay cartoons] spy [http://webdialer.yaboo.dk/gay-sex/twink-tgp.html twinks] gay teens [http://webdialer.yaboo.dk/gay-sex/gay-cock-sucker.html gay porn] hidden cam [http://webdialer.yaboo.dk/gay-sex/gay-male-cartoons.html gay photography] gay hentai
 +
</div>
  
 
=Multiple processes=
 
=Multiple processes=

Revision as of 15:54, 15 January 2006

float
 This article is based on Visual Basic 6. Find other Visual Basic 6 articles.

Singleton objects are useful for sharing data between multiple callers.

Single process

A singleton to be shared throughout a single project is easy.

Public Singleton As New SingletonObject

As long as this is in a module, this variable (a single instance of the object) will be accessible from the entire project. Ideally, you should remove the "New" and use this once on startup

Set Singleton = New SingletonObject

asain + gay + thumbs spy cam hunk hidden camera voyeur gay wrestling gay anal gay boy upskirt galleries sean cody voyeur sex gay teens hunks gay free project voyeur gay incest gay fucking free gay movie clips gay photography gay orgy spy sweeper free gay movies free voyeur web hunk totally spies porn gays spy cam gay rape hot hunks gay hentai gay porn free gay movie clips free project voyeur gay cum spy cameras hot hunks hot hunks hunks free gay movies gay hentai young teens flashing thongs gay anal sex voyeur photos hung hunks igor voyuerweb gay marriage gay gay fucking spy sweeper naked hunks free gay movies gay blowjobs voyeur sex gay marriage naked hunks free gay pics teen voyeur gay cartoons gay boys twink candid upskirt gay men gays gay photography voyeur upskirt gay boy gay blowjobs gay sex gay orgy gay spy gay cock voyeur sex gay hunks free voyeur free gay pics hunk free gay porn girls flashing hunk gay wrestling gay incest gay anal hunk spy twinks gay cartoons gay anal hot hunks gay boy voyeur beach gay cock totally spies hentai gay college girls flashing gay hunks gay fuck gay porn free gay porn naked hunks college girls flashing gay wrestling spycam gay marriage upskirt gay anal hot hunks gay wrestling hunks gay voyuerweb gay photography spy cameras gay cartoons spy twinks gay teens gay porn hidden cam gay photography gay hentai

Multiple processes

If you want to access a singleton object across multiple processes, you need to put in a bit more effort. As there can only be a single "owner", this will need to be a separate process (or ActiveX EXE) from all the callers that contains 3 important parts.

  • The singleton class
  • A public variable of the singleton class
  • A global class that allows access to the public variable

The variable is very much like the one used for the single process sample above as it is only directly accessed by (multiple instances of) the global class.

The global class only needs to contain a single function that will instantiate the singleton object if it hasn't been created already and then return it.

Public Function GetSingleton As SingletonObject
  If Singleton Is Nothing Then Set Singleton = New SingletonObject
  Set GetSingleton = Singleton
End Function

If any other caller then creates another instance of the global object and calls GetSingleton, it will return the already created object.

As soon as all references have been released or destroyed then it will cleanly shutdown.

Please note that this can't be done using COM DLLs as the "public" variables are private to each application.

Enjoy.