OPM code details of custom objects in ObjectARX

Source: Internet
Author: User
Tags dbx

The technical specifications for OPM development are as follows:

1, is a ATL-COM Project

1.1 is the dll library and references the com code.

1.2 you can also use the DBX type as the output, and let it do some work of the DBX library.

 

2. About the stdafx File

2.1 COM files to be included

In general, ccommodule is used to obtain a COM object, so that you do not need to reference the ATL

When referencing ATL, you can use catldllmodulet to create a COM object.

2.2 about _ atl_no_uuidof

The project contains or does not contain the project. The function is to be determined.

2.3 files including AC

# Include "acadi. H"
# Include "dbmain. H"
# Include "dbents. H"
# Include "dbsymtb. H"
# Include "dbobjptr. H"
# Include "rxregsvc. H"

 

3. Export Functions

3.1 should include at least the com Standard

Dllcanunloadnow
Dllgetclassobject
Dllregisterserver
Dllunregisterserver

These four functions have basic templates and can be used almost directly.

3.2 If DBX is used
Acrxentrypoint
Acrxgetapiversion


4. Create a comwrapper

The main task is to convert the interfaces of custom object attributes to interfaces of the COM type;

You can refer to the existing classes for writing. The internal function is basically the same as the general rules.

 

5. IDL Interface File

COM interface file, used to represent the com output interface, guid and other content

At the same time, the IDL file will automatically generate multiple documents, including

X_ I .h: It will be referenced in comwrapper. It is the C Language header file of the COM interface.

X_ I .c: referenced in dllmain. It is implemented by C language in COM.

X. TLB: Used in resource files

In principle, the positions of the above files can be arranged independently. in the sample, the files are output to $ (projectdir ).

Out of the principle of separating temporary files, I select to output to $ (intdir), which can be arranged as needed, as long as the directory is included.

 

5. In the resource file

5.1 Add the RGS file to the resource as the registry resource. This information will be used for installation and uninstallation.

5.2 Add a compilation command to the resource inclusion to include the TLB file in the Resource

1 typelib "idloutputname. TLB"

Note: idloutputname is a fixed hard-coded object, including a path. You do not need to specify $ (projname) as long as it is the name of the IDL output.

Here, I add $ (intdir) as an additional include path in the project resource attributes.

 

6. RGS File

It is a registry information file, but this registry file must exist in resources. External programs can register and uninstall COM components based on the information.

The basic operation is to use the template to replace the guid.

However, note that the content in different samples may be different. You only need to pay attention to version matching.

 

7. Registry File

Reg file, register the final DLL file to the system, this part is completely independent. You only need to write the guid and path according to the template.

Registering with the operating system can be solved through another method;

You can package the OPM DLL

 

8. A few other things I don't understand

8.1 apartment_threaded

Disablethreadlibrarycals (hinstance) in dllmain );

_ Atl_apartment_threaded in stdafx

Val threadingmodel = s 'apartment 'in RGS'

Keep it as it is

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.