The following list describes what is needed to start writing a sending or receiving application using COM components. Note that not all the possible tasks that can be implemented by your application are covered here. However, this topic does provide a basic understanding of what DLLs, objects, and methods are used to perform the tasks that most sending and receiving applications will need to perform.
- Make sure that you know how Message Queuing is deployed. For example: are the queues you are sending messages to or reading messages from local or remote, is your application going to have access to the directory service at all times, is Message Queuing deployed across different enterprises, is Message Queuing deployed in a mixed mode environment.
- To use smart pointers, Mqoa.dll must be imported to your application. All the C++ COM code examples provided by the Message Queuing SDK assume that the application imports this DLL using the #import directive and specifies the MSMQ namespace.
The #import directive generates two files that contain smart-pointer declarations for all Message Queuing objects: Mqoa.tlh and Mqoa.tli. The .tli file is included by an #include directive in the .tlh file, which is processed by the compiler as if it were named by an #include directive in your application. Do not include the Mqoai.h header file when you import Mqoa.dll.
Before using any smart pointer, your application must call CoInitialize or CoInitializeEx to initialize the COM library. After the COM library is no longer needed, your application must call CoUnitialize.
- To create a queue, create a smart pointer to the