ATLAsync.exe: Using MSMQEvent Events With ATL 3.0 For Asynchronous Message Notification (236587)
The information in this article applies to:
- Microsoft Message Queue Server (MSMQ) 1.0
This article was previously published under Q236587 SUMMARY ATLAsync.exe is a sample that demonstrates using ATL 3.0 to
sink MSMQEvent events. This sample uses IDispEventImpl to sink the events
for the MSMQEvent co-class. In order to compile and run this sample you must
have ATL 3.0 or higher and the MSMQ SDK installed. MORE INFORMATIONThe
following files are available for download from the Microsoft Download
Center: For
additional information about how to download Microsoft Support files, click the
following article number to view the article in the Microsoft Knowledge Base: 119591 How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most
current virus-detection software that was available on the date that the file
was posted. The file is stored on security-enhanced servers that help to
prevent any unauthorized changes to the file.
The following table describes the files necessary for
the ATLAsync.exe application: |
ATLAsync.cpp | 4,383 | Main implementation file,
contains implementation for CExeModule and WinMain | ATLAsync.dsp | 13,092 | Project file | ATLAsync.dsw | 636 | Project workspace | ATLAsync.h | 1,303 | Header for main
implementation file | ATLAsync.idl | 414 | IDL code for server | ATLAsync.rc | 4,270 | Resource script | ATLAsync.rgs | 179 | ATL registry information for
registering server | ATLAsyncps.def | 250 | DEF file for project proxy
stub | ATLAsyncps.mk | 466 | Makefile for proxy
stub | ATLAsync_i.c | 949 | MIDL generated file to
contain GUIDs and other data | EnterQueueForNotificationDlg.cpp | 266 | Source
file for main dialog | EnterQueueForNotificationDlg.h | 5,393 | Header
file for main dialog, contains the implementation for
CEnterQueueForNotificationDlg | readme.txt | 1,590 | Project readme file | resource.h | 813 | Resource header | SinkMSMQEvents.cpp | 8,519 | Implementation for
CSinkMSMQEvents and CQueueSinks | SinkMSMQEvents.h | 2,222 | Header for
SinkMSMQEvents, contains the definition of CSinkMSMQEvents and CQueueSinks | StdAfx.cpp | 315 | Precompiled header source
file | StdAfx.h | 1,201 | Precompiled header file |
This project demonstrates how to sink MSMQEvent
events using ATL 3.0. The IDispEventImpl class in ATL allows your class (in
this case CSinkMSMQEvents) to sink IDispatch events. The actual event sink is
set up with both the sink map:
BEGIN_SINK_MAP(CSinkMSMQEvents)
SINK_ENTRY_EX(0, DIID__DMSMQEventEvents, 0, Arrived)
SINK_ENTRY_EX(0, DIID__DMSMQEventEvents, 1, ArrivedError)
END_SINK_MAP()
and the call to DispEventAdvise() in CSinkMSMQEvents::AdviseSource().
In addition CSinkMSMQEvents contains an instance of the MSMQEvent object
and a reference to the MSMQQueue object passed to CMSMQEvents::AdviseSource().
All of the event sinks (CSinkMSMQEvents objects) are contained in a Standard
Template Library (STL) list which is contained in a CQueueSinks object. An
instance of this class is contained in the CEnterQueueForNotificationDlg dialog
class. This is used to set up the event sinks. This example will
allow you to set up notifications on any number of queues and send test
messages to see the notifications work. To set up notifications on a queue,
enter the name in the upper edit box of the dialog box. The second edit is used
to enter the name of the queue to which you want to send test messages
to. When you notify on a queue, the sample code will propagate the
path name of the queue to the send test message edit box. If you attempt to
notify on a queue that does not exist, the sample will attempt to create that
queue. REFERENCES For additional information, please click the article
number(s) below to view the article(s) in the Microsoft Knowledge Base: 194179 SAMPLE: AtlEvnt.exe Creates ATL Sinks Using IDispEventImpl
181277 SAMPLE: AtlSink Uses ATL to Create a Dispinterface Sink
Modification Type: | Minor | Last Reviewed: | 8/5/2004 |
---|
Keywords: | kbdownload kbfile kbhowto KB236587 kbAudDeveloper |
---|
|