COM events

I am writing a COM client prog in MFC / Visual studio 2003.

The COM server has an event (callback) interface and a "normal" interface.

I have created the class for the "normal" interface thru the class wizard
Add Class from the TLB file of the server object.
I use this class thru ::CreateDispatch.

For the callback interface, I have found that the wizard Add Claas does not
create something I could use, so I have created by hand a class, derived
from CCmdTarget with automation capabilities.

Now the question : How do I use the class wizard to create in that class
(with the correct DISPATCH TABLE entries) the callback functions I want to
implement from my object ?
And how do I instanciate that class ?

Thanks for helping me.

Fran�ois.



0
fcompagne (3)
1/9/2006 9:20:43 AM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
598 Views

Similar Articles

[PageSpeed] 37

This may help you:
http://www.codeproject.com/com/TEventHandler.asp

Take a look to the sample app

Fran�ois a �crit :
> I am writing a COM client prog in MFC / Visual studio 2003.
> 
> The COM server has an event (callback) interface and a "normal" interface.
> 
> I have created the class for the "normal" interface thru the class wizard
> Add Class from the TLB file of the server object.
> I use this class thru ::CreateDispatch.
> 
> For the callback interface, I have found that the wizard Add Claas does not
> create something I could use, so I have created by hand a class, derived
> from CCmdTarget with automation capabilities.
> 
> Now the question : How do I use the class wizard to create in that class
> (with the correct DISPATCH TABLE entries) the callback functions I want to
> implement from my object ?
> And how do I instanciate that class ?
> 
> Thanks for helping me.
> 
> Fran�ois.
> 
> 
> 
0
1/9/2006 4:40:52 PM
The article is good on COM evnets, but I am really seeking for is as the
article says how can I fit an event handler into my code via the wizard.

There are some ms KB explaining how to do it by hand (DISP_FUNCTION_IDand
so), but I am trying to do it with the wizard.



"Mathieu DEGROUX" <mathieu.degroux@ebp.com> wrote in message
news:eXni2tTFGHA.648@TK2MSFTNGP14.phx.gbl...
> This may help you:
> http://www.codeproject.com/com/TEventHandler.asp
>
> Take a look to the sample app
>
> Fran�ois a �crit :
> > I am writing a COM client prog in MFC / Visual studio 2003.
> >
> > The COM server has an event (callback) interface and a "normal"
interface.
> >
> > I have created the class for the "normal" interface thru the class
wizard
> > Add Class from the TLB file of the server object.
> > I use this class thru ::CreateDispatch.
> >
> > For the callback interface, I have found that the wizard Add Claas does
not
> > create something I could use, so I have created by hand a class, derived
> > from CCmdTarget with automation capabilities.
> >
> > Now the question : How do I use the class wizard to create in that class
> > (with the correct DISPATCH TABLE entries) the callback functions I want
to
> > implement from my object ?
> > And how do I instanciate that class ?
> >
> > Thanks for helping me.
> >
> > Fran�ois.
> >
> >
> >


0
fcompagne (3)
1/10/2006 9:01:00 AM
Reply:

Similar Artilces:

sauheungcarmenc@yahoo.com.hk
...

definning events along X axis
I currently havre a pretty basic graph with time on the X axis and sales along the Y. What I was wondering is whether there is a way to define certain events on the graph to better put into context the sales performance achieved during these events. Example: the graph already shows sales activity on a daily basis for the month of may. I am open to any non pie-type graph that would allow me the extra functionality of charting, in any reasonnable manner (other then manualy touching up dates on the finished graph) these respective dates: -may 1 to may 5 as a promotional event -may 12 to may 19t...

Users have no master SID errors in event logs (event id 9548)
There are loads of these errors on our Exchange 2003 server in the events: Disabled user /o=CompanyNameLtd/ou=London/cn=Recipients/cn=Bristol/cn=Harry does not have a master account SID. Please use Active Directory MMC to set an active account as this user's master account. are these accounts that had mailboxes and have been disabled? does this apply? http://support.microsoft.com/default.aspx?scid=kb;en-us;555410 "SW" <SW@discussions.microsoft.com> wrote in message news:2CA9AB75-AF36-45EA-9DB7-818D1FA32562@microsoft.com... > There are loads of these errors on our...

COM Writing Problem: Dead COM?
My code has worked in the past, but now it does not. I can open a COM Port using CreateFile, and the handle is valid. GetCommState is successful. SetCommState is successful. GetCommTimeouts is successful. SetCommTimeouts is successful. Next, I try to write to the COM Port using WriteFile, but it returns FALSE and GetLastError = Error 31: A device attached to the system is not functioning. Is there some way to reset the COM Port? I have tried rebooting as well as enabling/disabling the COM Port, but nothing seems to work! Did I damage the COM Port? FYI: This is on a Pocket PC where the...

Create ItemCheck event with Listview from Common Controls 5.0
Hello, I'm using the Listview from MS Common Controls 5.0, because it supports XP style and I'm adding checkboxes with the LVS_EX_CHECKBOXES constant. This works fine, but when the user clicks on a checkbox, the data from that row needs to be copied to an other Listview and some other things need to be done. The problem is that the 5.0 Listview doesn't have an ItemCheck event, like the 6.0 Listview does. I can get the state of the checkbox manually with SendMessage and the LVM_GETITEMSTATE constant, but then I have to loop through the Listview continuously. Is there a way...

zoinky420@yahoo.com
...

VS 2005 Com Interop Exception in Web Service
Hi, I have a service, that runs perfectly when executed outside of the web service environment. When called as a web service I get the exception listed below sporadically. A call to the web method may succeed one time and not another. I cannot find any reason why it would work one time and not another. The exception occurs every two or three calls to the web method. The service utilizes a COM component provided by PeopleSoft called a Component Interface. That COM object then makes calls into a Java library. Layers to the max I know but it is all I can work with right now ti...

Newbie Question: Handle MouseMove events on a Picture Control (Static)
I've some pictures on a dialog base application. I want to handle all MouseMove events on the pictures. But there only is Click event in ClassWizard. How can I solve it? Thanks a lot to any reply! Regards, Tony. It does not matter if the messages appear in class wizard. Just cut paste or type it directly. I hardly ever use class wizard. Since it is a CStatic, use SS_NOTIFY to get mouse notification. -------- Ajay Kalra ajaykalra@yahoo.com Tony wrote: > I've some pictures on a dialog base application. I want to handle all > MouseMove events on the pictures. But there only is...

MSExchangeDSAccess Event ID 2115
Getting warning message: Process INETINFO.EXE DSAccess needs to close a connection to the Domain Controller (servername) due to error 0x80040920 Any one aware of why this might be happening. Exchange 2003 SP2. Kent Maybe network issues? Is your Ex and DC on same box? How many GC's do you have? Does it close the session and re-establish or do you have to do something? James Chong MCSE M+, S+, MCTS, Security+ msexchangetips.blogspot.com ftp://mail.msexchange911.net/ Kent wrote: > Getting warning message: Process INETINFO.EXE DSAccess needs to close a > connection to the Domain ...

Does Event 1221 include edb AND stm sizes ?
Hi, Like many people here, I seem to have a size problem. I run Exchange 2K Standard on AD 2K, and I get near the 16 GB limit. I looked at the 1221 events in the server logs, and I found that after offline defrag there are 1215 MB available (and 1414 the day before). The problem is, I see this morning that the .stm size has growned up during the night (the .ebd size has not changed). Does 1221 event sum up the 2 files sizes ? And do I conclude that my .stm file is really full of valuable data and therefore not shrinkable ? Thanks for your help ... On Fri, 10 Jun 2005 03:34:02 -0700, &q...

a@right.com autocompletes to a@right.com <a@wrong.com>
The following continues to happen. a@right.com autocompletes to a@right.com <a@wrong.com> How to stop this? And what does this have to do with Outlook? --=81 Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. All unsolicited mail sent to my personal account will be deleted without reading. =20 After furious head scratching, Tom asked: | The following continues to happen. |=20 | a@right.com autocompletes to a@right.com <a@wrong.com> |=20 | How to stop this? Delete the incorrect autocomplete entry by highlighting it and hitting the ...

On Current Event seems to be disabled for .requery
I am adding some featuring to a form that someone else designed (they are no longer available for questions about the form). I normally expect the On Current Event to launch whenever a .requery operation is requested in any other procedure in the same form. However, with this form, a .requery does NOT launch the On Current Event. Anyone have an idea what setting might be responsible for producing this particular behavior? Thanks much! Does it fire otherwise? Sometimes procedures get disassociated from the events to which they're supposed to be associated. Look at the P...

COM function
When I have a COM interface with functions like the following, how to can call the put_ConnectionString correctly? when I do the following I got compile error BSTR bstr = "aaa"; hr.put_ConnectionString(bstr); ################################### HRESULT CEPGLibApp::LoadXMLData(LPCTSTR tszXMLFileName) { HRESULT hr = S_OK; CComPtr<ISQLXMLBulkLoad> pIXMLBulkLoad; hr = CoCreateInstance(CLSID_SQLXMLBulkLoad3, NULL, CLSCTX_INPROC_SERVER, IID_ISQLXMLBulkLoad, (void **)&pIXMLBulkLoad); if (SUCCEEDED(hr)) { BSTR bstr...

How to automatically make a event receive class .
I'm trying to make a event receive class from ISAXContentHandler of MS-XML4. Of course, I know to make a event receive class by manual. What I want to know is how to make a that class automatically. There are a many of pure virtual funtions in ISAXContentHander interface. So it's hard work to declare all virtual fuction by manual. I think there is auto function to supply in VS6. I'm VS6++ User. I'm finding your advise. Thanks. -Chul Hyun- ...

visit http://www.real-article.com/office/index.php
The www.real-article.com website provides a ton of information about game. In addition, you will find extensive information on leading game to help you on your way to success. Please have a look at our game articles, products, resources, and additional information located throughout www.real-article.com. We strive to provide only quality articles, so if there is a specific topic related to game that you would like us to cover, please contact us at any time. visit http://www.real-article.com/office/index.php ...

econnect 9.0 installation com+
I am installing eConnect 9 on a local machine with SQL Server Express and GP 9 installed. Running WinXP Pro sp2. When I get to the end of the installation process and need to enter the Domain/user and pass, I enter "eConnect" as the user I created in users and Groups. "eConnect" user is part of the admin group. I receive the following errors and installation fails. "The eConnect Incoming Service Returned the following error: Status Invalid Service Account" "The eConnect Outgoing Service Returned the following error: Status Invalid Service Account" ...

Event ID 20159
Hi I have a remote who connects to their ISDN modem via Wireless, and then VPN's into our serverf. She is complaining that when in Outlook, she is continually being disconnected. There is nothing in our server logs. I have had hem send me a copy of their Event Logs, and the only thing I can see is "Event ID 20159: The connection to Moustraining made by user tricia using device VPN5-1 was disconnected." Has anyone any ideas what this is happening Thanks Alex How does this disconnect manifest itself? What is causing her to complain? Nue "Al" <ah@moustra...

Outlook 97 PRO w/ Netzero.com
Hi! I believe I have done everything necessary to configure Outlook 97 Pro to send and receive mail, via Netzero.com. I do not use the WEBMAIL in Netzero...just the regular MY NETZERO MAIL. When I send myself an email it goes into the SENT box, but doesn't come into the INBOX later on. I click on it and I see the following message: "Not delivered because there is no carrier provided!" Gee whiz, I'm online! Hwta carrier doe the error emssage refer to? Help, somebody?? Thanks, Mike Do you have your account (incoming and outgoing servers) installed correctly in Outlook? ...

rejected e-mail address to hotmail.com
The message could not be sent. The authentication setting might not be correct for your outgoing e-mail [SMTP] server. For help solving this problem, go to Help, search for "Troubleshoot Windows Mail", and read the "I'm having problems sending e-mail" section. If you need help determining the proper server settings, please contact your e-mail service provider. The rejected e-mail address was 'someone@hotmail.com'. Subject 'Reset Your Mouse For 2010', Account: 'po.pacific.net.id', Server: 'smtp.telkom.net', Protocol: SMTP, S...

MSExchangeSA generates Event 9099 every 5 minutes
I have Exchange 2003 on Windows 2003. After restart it suddenly start generating event id 9099 every 5 minutes in app logs. Event Type: Error Event Source: MSExchangeSA Event Category: Monitoring Event ID: 9099 Date: 5.7.2004 Time: 8:19:43 User: N/A Computer: KNEZ Description: The MAD Monitoring thread was unable to read the state of the services, error '0x80041003'. I read Q326011, but cdowfevt.dll looks registered correctly. Description for WMI error code 0x80041003 is WBEM_E_ACCESS_DENIED. How can I solve this? Thanks Rok Exchange itself is likely working fine, but manage...

Help: Outlook Today displays events on wrong date
Outlook Today shows certain events as occuring today, but in actuality and on the Outlook calendar they do not occur until tomorrow... Any help would be appreciated. ...

Why is this Load Event code not working? Please help.
I am trying to disable some controls on a form when it opens using this Load event but it is not working. Is there something I am doing wrong. I even tried using .Visible and that didn't work either. Can someone please tell me what I am doing wrong. Thank you. Private Sub Form_Load() If Me.txtVendor.Value = Null Then Me.txtVendor.Enabled = False End If If Me.txtReviewer.Value = Null Then Me.txtReviewer.Enabled = False End If If Me.txtBeginDateRange.Value = Null Then Me.txtBeginDateRange.Enabled = False 'Me.lblSDR.Enabled = False ...

COM ports and SQL compact suppport.
Using PB I am trying to build image Win CE 6 emulator that supports Com 1 and 2. When deployed, only COM1 is available. From catalog, I have selected COM 0, 1 and 2. If memory serves me well I think, I remember that COM0 is used by emulator to communicate with ActiveSync/Mobile Device center. I am not able to figure out what am I missing. I also need advice on how to include (install) SQL compact in the OS image. Wceload is included in the image. -- RainMan Somewhere in the Emulator configuration (not the BSP or your project) you need to give access to the COM por...

Toolbar Event Handler for .NET
What is the most simple way to add an Event Handler to a new Toolbar Button? In the context menu, I can not find any Add Event, only the properties dialog where there is nothing about events. I assume it is possible to add a handler by hand but I intend to have quite a few buttons so I want to simplify things a bit. I am using VS .NET om W XP prof. Thanks for any answer Anders Floderus ------------- m a i l : anders d o t floderus a t swipnet d o t se If you are using MFC, use ON_COMMAND and ON_UPDATE_COMMANDUI handlers for the button ID. YOu can put these in mainframe, document or vie...

Chart of Accounts for Events Management
Dear All, - Can any body provide me with best practice structure for Chart of Accounts Events Management for Racing Circuit? And my concern the profit & loss account structure for cost & profit center. - Can I have my departments, events, etc. cost / profit center outside my chart of accounts? If yes where I will store those account since I want them mandatory if they are outside my chart of account. And what you suggest to keep them in my chart of accounts or outside it. Regards You can use any standard Chart of Accounts. The few accounts that are industry specific can b...