MFC class wizard and IDISPATCH

Hello

In ATL projects wizard give us a chance to add class with Idispatch(Dual).

In MFC add class wizard, there is an option for Automation but this cause to 
add dispintarface. Also activex control projects add interfaces with 
dispintarface which means user can only use late-binding. Mayeb this may 
performance problems. I am not sure?

Is there a special reason to  doesn't have an option for dual interface in 
MFC project wizards..?
If we want to use dual interfaces in ou project, what must we do? Just 
manual edit?

Thanks..
0
Rotor (2)
10/24/2008 1:42:00 AM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
1049 Views

Similar Articles

[PageSpeed] 42

I think that if you want a more "COM-centric" approach, you should use ATL 
instead of MFC.
I learnt that, while MFC can help you in building COM components, ATL is 
definitely a better tool for that job.

(And you can use also WTL on the top of ATL, if you need some GUI classes 
that ATL does not provide "off the shelf".)

The dual-interface support of ATL is better, instead with MFC you should do 
much more typing and manual work.
(Basically I think that with MFC you should derive your own dual interface 
from IDispatch "by hand", and do all the manual job of 
BEGIN/END_DUAL_INTERFACE_PART, and then delegate your dual-interface method 
implementations to the existing MFC IDispatch interface implementation...)

You may find interesting this MSDN doc:

http://msdn.microsoft.com/en-us/library/4h56szat.aspx

HTH,
Giovanni


"Rotor" <Rotor@discussions.microsoft.com> ha scritto nel messaggio 
news:AC53A949-48B1-4AB4-A8CF-2D46E9E9DF08@microsoft.com...
> Hello
>
> In ATL projects wizard give us a chance to add class with Idispatch(Dual).
>
> In MFC add class wizard, there is an option for Automation but this cause 
> to
> add dispintarface. Also activex control projects add interfaces with
> dispintarface which means user can only use late-binding. Mayeb this may
> performance problems. I am not sure?
>
> Is there a special reason to  doesn't have an option for dual interface in
> MFC project wizards..?
> If we want to use dual interfaces in ou project, what must we do? Just
> manual edit?
>
> Thanks.. 


0
10/24/2008 7:41:59 AM
Thank you Giovanni. 

Also, the link is very helpful.

It is really intersting to not adding v-table binding support for MFC com 
development. At least i expected to see that support for Activex controls...

"Giovanni Dicanio" wrote:

> I think that if you want a more "COM-centric" approach, you should use ATL 
> instead of MFC.
> I learnt that, while MFC can help you in building COM components, ATL is 
> definitely a better tool for that job.
> 
> (And you can use also WTL on the top of ATL, if you need some GUI classes 
> that ATL does not provide "off the shelf".)
> 
> The dual-interface support of ATL is better, instead with MFC you should do 
> much more typing and manual work.
> (Basically I think that with MFC you should derive your own dual interface 
> from IDispatch "by hand", and do all the manual job of 
> BEGIN/END_DUAL_INTERFACE_PART, and then delegate your dual-interface method 
> implementations to the existing MFC IDispatch interface implementation...)
> 
> You may find interesting this MSDN doc:
> 
> http://msdn.microsoft.com/en-us/library/4h56szat.aspx
> 
> HTH,
> Giovanni
> 
> 
> "Rotor" <Rotor@discussions.microsoft.com> ha scritto nel messaggio 
> news:AC53A949-48B1-4AB4-A8CF-2D46E9E9DF08@microsoft.com...
> > Hello
> >
> > In ATL projects wizard give us a chance to add class with Idispatch(Dual).
> >
> > In MFC add class wizard, there is an option for Automation but this cause 
> > to
> > add dispintarface. Also activex control projects add interfaces with
> > dispintarface which means user can only use late-binding. Mayeb this may
> > performance problems. I am not sure?
> >
> > Is there a special reason to  doesn't have an option for dual interface in
> > MFC project wizards..?
> > If we want to use dual interfaces in ou project, what must we do? Just
> > manual edit?
> >
> > Thanks.. 
> 
> 
> 
0
Rotor (2)
10/24/2008 10:51:00 AM
Reply:

Similar Artilces:

A strange problem with MFC
Hi, Rencently I met a strange problem. The code like below: CWinThread* pThread = AfxBeginThread(ThreadFunc, (LPVOID)this, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED); if(pThread->m_hThread != NULL){ pThread->m_bAutodelete = FALSE; pThread->ResumeThread(); } After the statement "pThread->m_bAutodelete = FALSE" executed, I found the value of pThread->m_hThread is 0. While pThread->m_bAutodelete is still 1! The code section located in a win32 static library, with /Md option.The host application(exe) is a win32 console application, with /Md option. There...

Unicode in MFC
Hi, I am new to MFC programming and I have a problem: when I try to write the caption of a button or something else in my own language(Farsi), in the design mode it shows the correct string but when I compile it it shows a '?' instead of every character. Can anyone please help me with that. > I am new to MFC programming and I have a problem: > when I try to write the caption of a button or something else in my > own language(Farsi), in the design mode it shows the correct string > but when I compile it it shows a '?' instead of every character. Can > anyone ple...

return int value to OS in MFC App
Hi, Everybody. I have to make A MFC app to return int value to Operatiing System.. if i could use WinMain() function, this is not matter. but MFC does not reveal WinMain().... How can i solve this problem? Can Anybody help me with this problem? <flybluewing@bcline.com> wrote in message news:1189386249.923483.59250@y42g2000hsy.googlegroups.com... > Hi, Everybody. > > I have to make A MFC app to return int value to Operatiing System.. > > if i could use WinMain() function, this is not matter. > but MFC does not reveal WinMain().... > How can i solve this problem?...

mfc and IE activeX
I'm using VS 2003 and trying to use Internet Explorer in my MFC application but encountering problems If I built a very simple test dialog-application and drop in the IE it works exactly as expected. However, when I create a similar dialog box in my MFC application and call the ...DoModal() nothing appears at all - not even the dialog box itself. It's as if my application does not want to use ActiveX components - I also tried a couple of other Microsoft ActiveX controls and they have the same problem. I must be missing something obvious - any one with any ideas will be much ...

Need Help with MFC!!
Hi all, need help esp. with Graphic part. When you right click on any drive on your machine and click properties, you get a tabbed dialog. I want to know how can I embed graphic image (pie chart) into my MFC Dialog? I have written code which displays the Disk Usage right now but don't know how to display that info as a PIE CHART!!!!!! besides what type of MFC Dialog application should I look fwd to build? I want exactly as the DRIVE properties. TIA -- ======== Regards Vai ======== Have you looked at the CDC::Pie method? joe On Wed, 12 May 2004 23:07:11 -0400, "Vai2000"...

Unable to set the XValues property of the Series class
Hi I have one sheet. It contains some charts. I want to put th XValues use macro. But I am unable to run this macro. I got error a Unable to set the XValues property of the Series class.("Run time erro 1044"). Anybody can help me? My macro code is: ActiveWindow.Visible = False Windows("FullTemplate.xls").Activate Range("I22").Select ActiveSheet.ChartObjects("Chart 1031").Activate ActiveChart.ChartArea.Select *ActiveChart.SeriesCollection(1).XValues Worksheets("MonthlyData").Range("B2:B5")* ActiveChart.SeriesCollection(1).Va...

MFC to Console.
Hello Group. I need to convert the code of WiniNet Async Demo from microsoft samples from MFC to a console function.. Someone can help me with the changes.. The code is posted here Regards /* Microsoft Corporation Copyright 1999-2002 */ /******************************************************************** ProjectName : AsyncDemo Purpose : This sample demonstrates how to submit two WinInet requests, using InternentOpenUrl, asynchronously. Notes : This sample does not handle any authentication. To properly handle authentication, the functions that handle specific protocols (like Ht...

XML and MFC
Hello guys, What source of knowledge would you point me to if you were about to integrate XML with MFC? Of course if there's any Microsoft documentation anywhere, please post me a link to it. Thank you in advance! :-) Yea, I wanna know it too. Who would give a hand? > What source of knowledge would you point me to if you were about to > integrate XML with MFC? Of course if there's any Microsoft documentation > anywhere, please post me a link to it. After digging left and right, I remained with two main options: - MSXML - MS, proprietary, COM, with all the implications:...

Console output from MFC dialog based app
Dear All, I have developed a MFC dialog based application. Now when I execute this app from command prompt, I need to write some text back to console. In console application we achieve this using functions like printf(), puts(), etc. Please let me know how do I achieve same in dialog based application since printf() and other functions are not working here. Thanks, Ajay You can't write to the same console window that you were ran from, but you can create a console window and write to that. Take a look at AllocConsole, ReadConsole, and WriteConsole. Here is an example: http://www....

How to: class library write back to form
Hi, I=92m new to programming and I have a 2-tier app. A form and a class library. I know to call the class library I need to add a reference to the class library project, add a Using statement and instantiate the CL. In the CL I want to do some processing and update a text box back in the form. How to update the form from the class library? Do I need to add a reference from the CL to the EXE project? And do I need to instantiate the form to be able to update the textbox? Thanks much! MP Also, just to be a little clearer, I'm not talking about returning a value, I mean,...

Data Migration Wizard for Microsoft Office Outlook with Business C
Is there anyone, who have experience, in using the "Data Migration Wizard for Microsoft Office Outlook with Business Contact Manager" to import data to Microsoft CRM? My question is primary, if it is simple to use the tool and if all information can be imported? Best Regard CD You use the Data Migration Wizard to picks up csv files, generate the data maps from the csv sample files and import/export data & data maps. you can use the tool from within outlook 2007 which is the one you have i assume. Yet, if you want to synchronise your contact list with CRM then you ...

dynamically managing of layout in MFC + GridBagLayout in MFC or C++
Hi, can anybody tell me how can I make or find a function in MFC to manage layout of a dialog that dynamically has been create and also the controls in the dialog? I am new in MFC, what I am lokking for is something like GridBagLayout in java? is there something like this in C++ MFC ? any idea plz? Thank u There is nothing like GridBagLayout in MFC. However, you can achieve the same functionality thru various means. You have to move the controls manually on resize of the dialog or window. Please see the following examples: http://www.codeproject.com/dialog/easysize.asp http://www.codepr...

Sending Window Messages from an MFC app to a Windows Firm tray application
Hello, I have an MFC MDI application and a Windows Forms (2.0) Tray Icon application. I want to run a command on the tray application via my MFC application. There is a "Register" context menu command on the tray icon application. I want to call the Register command from my MFC MDI application. I thought of a windows message. How do I do it? Is there any other better mechanism to do so? Thanks, Janiv Ratson. If you know the class of the window on the tray application you can use FindWindow() to get the window for the class. Then you can use either PostMessage() or SendMessag...

Reporting back crashes in MFC-based products
Hello, We have a product written in MFC using Visual Studio 7.1. We are now planning to implement a feature that will detect a crash and report to us the cause of the crash and other meaningful information. The plan is to provide something similar to Window's error reporting tool. I found a 3rd party tool for Delphi that instruments the source code. When the program crashes, it provides information like the name of the function, module etc.. Is there something similar that I can use with MFC? The other option is to use MFC's Structured Exception Handling and try to get a memory dump...

VBA online classes
Hi All, Can you all please help me find a very effective VBA online classes? i don't consider myself to be literate in this field at all. Thanking in advance. Glad. Good Morning, I’m not sure about classes (other than community colleges that offer expensive short courses), but there are plenty of online sites that offer free code and also some really great books available for sale at your local bookstore. One of my favorite books that I’ve use more often than anything else is called “Excel 2007 – Power Programming with VBA”. This book is written by John Walkenbach and...

Access and MFC
I would like to use some MFC capabilities from within Access. In PDC05/PRS313, Nick Kramer gave examples of using HWND's to create mixed Win32/Windows Presentation Foundation applications. I remember reading recently somewhere that Microsoft has released the MFC for general use. Can anyone provide information about (or even verify) the MFC release? Thanks, James A. Fortune CDMAPoster@FortuneJames.com MPAPoster@FortuneJames.com Microsoft Cabinet SDK: http://msdn2.microsoft.com/en-us/library/ms974336.aspx ...

bug of MFC ActiveX Control?
i create a default MFC activex control by wizard, i just check the windowlessActivate option, because i want to create a transparent control. but when i use the control in vb, the form_keydown event will be triger twice. i recompile the control after comment the follow line: dwFlags |= windowlessActivate; all things is ok. can someone confirm this "bug"? -- ף���ˣ� Maybe my english is so poor? Or something else? "sPhinX" <s5689412@163.com> д���ʼ� news:eQ$NrxkcFHA.4040@TK2MSFTNGP14.phx.gbl... > i create a default MFC activex control by wizard, > i just ch...

MFC Application has encountered a problem and needs to close. HELP
This is driving me nuts. Whenever I run my program in release configuraiton it always crashes with the above error message offering me an option to send a message to Microsoft. I have discovered it is an access violation (code 5). Whenever I run the program in debug configuration it runs OK. I have two main questions: 1 How can the program behave so differently in the two configurations? I can find no explanation of this in the help files. 2 How can I get useful information about the access violation? I cannot save the crash dump produced which the exception handler offers to send to ...

Formatting Excell doc from within MFC app
Hello. I'm developing an application using MFC - VC++ 6.0 I'm wondering if there is an ActiveX control or other component that would make possible to make simple editing and formatting MS EXCELL doc from rithin application. The operations i would like to perform: - opening .xls file - inserting values into cells and simple formatting the cells (alliginig,, etc) - save the file - printing and displaying (not necessary) Thank You all for any help Sincerelly, magic ...

Static variables initialization problem with MFC DLL
Hi, I have the following code, working well in my MFC app, where a static member variable is initialized with the result of a static method, as this : int MyClass::anInt = MyClass::InitTheInt(); The problem is when this code is used in a DLL -using MFC in a shared DLL-, the initialization is simply ignored !!!! What's going on? Thx. Herbert wrote: >Hi, > >I have the following code, working well in my MFC app, where a >static member variable is initialized with the result of a static >method, as this : > > int MyClass::anInt = MyClass::InitTheInt(); &g...

WSE 2.0- Generating abstract SoapService classes from WSDL
WseWsdl2.exe can be used to generate SoapClient classes from the WSDL. How can we generate abstract classes for WSE 2.0 based web service implementation based on the contracts specified in a WSDL file (just like WSDL.exe). Manually coding the server is not an option as the WSDL file is complex. there is a group for WSE., microsoft.public.dotnet.framework.webservices.enhancements -D "raj712k" <raj712k@discussions.microsoft.com> wrote in message news:8B2A38FC-B82A-4604-98F3-AC736E92F8A5@microsoft.com... > WseWsdl2.exe can be used to generate SoapClient classes from the WS...

Unrecognised database format '<filename>' in Class Wizard
trying to create my RecordSet classes (derrived from CDaoRecordSet) in class wizard, after selecting my (Acces 2000) database and hitting OK i get this error: Unrecognised database format '<c:\Program Files\Microsoft Visual Studio\My Projects\GMF PoS\POSData.mdb' if i convert the database to Access 97 format (in access) it works, but the release EXE will only access the database on machines with Visual studio installed. I am using Visual C++ 6.0 sorry, misspelling. should be "ClassWizard Error: Unrecognized database format '<filename>'" "Jose...

Is GDI+ Integrate with MFC?
Apparently, GDI+ is not intended to be used with MFC as GDI is. Is GDI+ a more stand-alone technology? Granted it can be used in MFC apps but the MFC classes do not seem to wrap GDI+. Is it resonable to use GDI+ without MFC at all? Thank You It's just another API. Why wouldn't it be reasonable to use without MFC? joe On Tue, 13 Feb 2007 21:54:49 -0800, Coder <Coder@discussions.microsoft.com> wrote: >Apparently, GDI+ is not intended to be used with MFC as GDI is. Is GDI+ a >more stand-alone technology? Granted it can be used in MFC apps but the MFC >classes...

Updating database worksheet problem (Template Wizard)
Got my template for setting up client jobs info all made up & linked (via Template Wizard setup) to a database worksheet (Excel 97) for summaries of various stuff - start dates/employee responsible/etc. So - I open my template & fill in the starting info; then do a "Save As" ClientsName.xls - when I do this save, I know the database worksheet opens in the background (I tested this by trying a messagebox @ the "Workbook_Open" event) - in fact it seems to open twice - but the first time I save, and even when I close the book & am prompted to save again, there is ...

Regular MFC dll
I created an MFC regular dll with MFC statically linked using MFC Appwizard(dll) and then I compiled the code generated by the AppWizard without adding any code. I got the these compile errors Compiling resources... Compiling... StdAfx.cpp c:\program files\microsoft sdk\include\shobjidl.h(9419) : error C2061: syntax error : identifier 'IXMLDOMDocument' c:\program files\microsoft sdk\include\shobjidl.h(9528) : error C2061: syntax error : identifier 'IXMLDOMDocument' Error executing cl.exe. How can I reomve these error. Thanks ...