Creating Component Object Model (COM) Object |
|
Tips >> Visual Basic | |
|
|
MAKE WEB APPLICATION WITHOUT KNOWLEDGE OF CODING? CLICK HERE The Component Object Model (COM) is a Microsoft framework for managing component objects, allowing them to communicate by calling methods of other components in their object workspace. Each component in the framework is a self-contained program. Traditional programs cannot communicate with programs outside their workspace when running, without using other services such as DDE, TCP/IP, etc. ActiveX is the name given to the services based around the COM framework. The components may be visual (embedded into other documents using Object Linking and Embedding), or a set of services (compiled as a Dynamic Link Library (DLL)).
DISTRIBUTED COM: The Distributed Component Object Model (DCOM) extends the
COM framework so that components may communicate across different computers.
It achieves this by executing a Remote Procedure Call (RPC) to
a server, which executes the method and returns the results to the client.
Creating DCOM components allows you to extend the functionality
of ASP. As the components are compiled, they tend to run much faster than
calling script routines through the ASP interpreter.
REGISTERING COMPONENTS: When you develop a COM object, the component is automatically
registered on the computer when it's compiled. If you are developing a
component for another computer, then you have to copy the compiled DLL
to the server and register it explicitly using regsvr32.
BUILDING A COM OBJECT WIITH VISUAL BASIC: The discussion has thought to create a COM object using Visual Basic.
The object will be used to determine if a string is a palindrome (a
string that reads the same forwards as it does backwards, ignoring case
and punctuation).
STARTING THE PROJECT: Start an ActiveX DLL project in Visual Basic. Set the name of the project to CheckPalindrome, and the name the Class Module Palindrome. The following is the code for the Class module
|
|
|
|
Create the DLL by selecting "Make CheckPalindrome.dll" from the File menu. The component will be automatically registered on the machine.
TESTING THE COMPONENT: You can test the new object by creating a new Standard Exe project
in Visual Basic. In the new project, select the "Project"
menu item, then select "References". Scroll down to our
new component "CheckPalindrome", and place a tick against
it. You can now use the object directly in the project.
|
|
|
|
REGISTERING THE COMPONENT ON A SERVER To use the component with ASP, we need to register it on the server. Copy the file to the server, and then register it using regsvr32 |
|
|
|
Once the components registered, you can access it in ASP as follows: |
|
|
|
If you don't find what you are looking for. Please click here to submit your query, our experts will reply soon. |
Terms and Conditions / Privacy Policy / Refund Policy / Shipping Policy