Click here to Skip to main content
14,124,474 members
Click here to Skip to main content

Stats

710.7K views
4.5K downloads
436 bookmarked
Posted 31 Dec 2004
Licenced CPOL

Understanding The COM Single-Threaded Apartment Part 1

, 6 Jan 2005
Learn the fundamental principles of the COM Single-Threaded Apartment Model by code examples.
LegacyCOMObject1
Shared
SimpleCOMObject1
SimpleCOMObject2
Test Programs
LegacyCOMObject1.def
LegacyCOMObject1.dsp
LegacyCOMObject1.dsw
LegacyCOMObject1.rgs
LegacyCOMObject1.tlb
LegacyCOMObject1ps.def
SimpleCOMObject1.def
SimpleCOMObject1.dsp
SimpleCOMObject1.dsw
SimpleCOMObject1.rgs
SimpleCOMObject1.tlb
SimpleCOMObject1ps.def
SimpleCOMObject2.def
SimpleCOMObject2.dsp
SimpleCOMObject2.dsw
SimpleCOMObject2.rgs
SimpleCOMObject2.tlb
SimpleCOMObject2ps.def
VBTest
VCTests
MSSCCPRJ.SCC
VBTest.exe
VBTest.vbp
VBTest.vbw
DemonstrateDefaultSTA
DemonstrateExeServerSTA
DemonstrateLegacySTA
DemonstrateNoMessageLoop
DemonstrateSTA
VCTest01
VCTest02
SimpleCOMObject2.tlh
SimpleCOMObject2.tli
VCTest01.dsp
VCTest01.dsw
SimpleCOMObject2.tlh
SimpleCOMObject2.tli
VCTest02.dsp
VCTest02.dsw
Client
Implementation
Interface
VCTest01
VCTest01.dsp
VCTest01.dsw
ExeServerImpl
ExeServerImpl.dsp
ExeServerImpl.dsw
REGISTRY.CPP
REGISTRY.H
ExeServerInterfaces
ExeObj01.rgs
ExeObj02.rgs
ExeObj03.rgs
ExeServerInterfaces.def
ExeServerInterfaces.dsp
ExeServerInterfaces.dsw
ExeServerInterfaces.tlb
ExeServerInterfacesps.def
VCTest01
VCTest02
LegacyCOMObject1.tlh
LegacyCOMObject1.tli
VCTest01.dsp
VCTest01.dsw
VCTest02.dsp
VCTest02.dsw
VCTest01
SimpleCOMObject2.tlh
SimpleCOMObject2.tli
VCTest01.dsp
VCTest01.dsw
VCTest01
SimpleCOMObject2.tlh
SimpleCOMObject2.tli
VCTest01.dsp
VCTest01.dsw
VERSION 5.00
Begin VB.Form FormMain 
   Caption         =   "Form Main"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command_DoLengthyFunction 
      Caption         =   "Do Lengthy Function"
      Height          =   495
      Left            =   240
      TabIndex        =   0
      Top             =   480
      Width           =   3975
   End
End
Attribute VB_Name = "FormMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim WithEvents SimpleCOMObject1Obj As SimpleCOMObject1
Attribute SimpleCOMObject1Obj.VB_VarHelpID = -1


Private Sub Command_DoLengthyFunction_Click()
  SimpleCOMObject1Obj.DoLengthyFunction 5000
End Sub

Private Sub Form_Load()
  Set SimpleCOMObject1Obj = New SimpleCOMObject1
  
  SimpleCOMObject1Obj.Initialize
End Sub

Private Sub Form_Terminate()
  SimpleCOMObject1Obj.Uninitialize
End Sub

Private Sub SimpleCOMObject1Obj_LengthyFunctionCompleted(ByVal lStatus As Long)
  Dim strMessage As String
  
  strMessage = "Lengthy Function Completed. Status : " & Str$(lStatus)
  
  MsgBox strMessage
End Sub

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Lim Bio Liong
Systems Engineer NEC
Singapore Singapore
Lim Bio Liong is a Specialist at a leading Software House in Singapore.

Bio has been in software development for over 10 years. He specialises in C/C++ programming and Windows software development.

Bio has also done device-driver development and enjoys low-level programming. Bio has recently picked up C# programming and has been researching in this area.

You may also be interested in...

Pro
Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03 | 2.8.190518.1 | Last Updated 6 Jan 2005
Article Copyright 2005 by Lim Bio Liong
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid