Nested class using MFC


I'm using a COM Dll  and a COM client that I have copied from a book.
This COM dll is using MFC and the COM client exe file is also using MFC.
I have removed some code just to make it easier to figure out my problem.
The code that I have removed does't affect the question in any way.

In the code you have one interface called IVisual you have it below.
struct IVisual : public IUnknown
    STDMETHOD_(void, Display) () = 0;

As you know in Interface IUnknown are there three pure virtual functiones
QueryInterface, AddRef and Release.
The functions QueryInterface, AddRef, Release and Display must be
implemented by the class that is derived from IVisual.

I do understand that function Display must be manually implemented.
Now to my question: One thing that I'm unsure about is the other three
functions QueryInterface, AddRef and Release.
Will anything of these three functions be created as a stub by the visual
studio tool(MFC) or nothing at all.
I mean will anycode at all be created for these three functions that must be

Below are these 4 functions  implemented.
STDMETHODIMP CSpaceship::XVisual::QueryInterface(REFIID iid, LPVOID* ppvObj)
    ITrace(iid, "CSpaceship::XVisual::QueryInterface");
    METHOD_PROLOGUE(CSpaceship, Visual)
    return pThis->ExternalQueryInterface(&iid, ppvObj);
STDMETHODIMP_(ULONG) CSpaceship::XVisual::AddRef()
    METHOD_PROLOGUE(CSpaceship, Visual)
    return pThis->ExternalAddRef();
STDMETHODIMP_(ULONG) CSpaceship::XVisual::Release()
    METHOD_PROLOGUE(CSpaceship, Visual)
    return pThis->ExternalRelease();
STDMETHODIMP_(void) CSpaceship::XVisual::Display()
    METHOD_PROLOGUE(CSpaceship, Visual)
    TRACE("m_nPosition = %d\n", pThis->m_nPosition);
    TRACE("m_nColor = %d\n", pThis->m_nColor);

Here you have the class definition.

class CSpaceship : public CCmdTarget
    int m_nColor;
 CSpaceship();           // protected constructor used by dynamic creation

// Attributes

// Operations

// Overrides
 // ClassWizard generated virtual function overrides
 virtual void OnFinalRelease();

// Implementation
 virtual ~CSpaceship();

 // Generated message map functions
  // NOTE - the ClassWizard will add and remove member functions here.


        STDMETHOD_(void, Display) ();



12/15/2004 2:36:06 PM
vc.mfc 33608 articles. 0 followers. Follow

0 Replies

Similar Articles

[PageSpeed] 14


Similar Artilces:

How to use Outlook express
hi, is it possible to set up outlook exp. but not allow it to be the default mail client? i'd like to 'check' the link on a page that says: 'contact' and have that email address come up in outlook exp., then copy/paste the address to my own AT&T mail service but not use outlook express for anything else. as of now, i have outlook exp. disconnected altogether and do not wish to use it other than to open up a link. all responses on this are welcome......... thanx, jim Dear, This is an Outlook News group not Outlook Express - since you asked , here is the info for th...

VBA code using if then and msgbox
I wanted to use a macro that does the following. Currently I have created a userform inventory list. In the userform I entered the item sold and the quantity sold. I wanted to somehow squeeze a macro in this userform that would do the following. If for instance there is one item remaining in inventory and I accidentally put 2 items were sold, I want the macro to check my inventory list and have a msgbox pop up saying something like "Items sold exceeds inventory remaining. Please check inventory!" However, I am not the best at userforms and I dont know if I can use an If stateme...

Sum all values using IF function
I have a list full of information on my sheet. One column displays a department number and another column displays a number of hours that this department has worked. I need to sum together all the hours of a certain department to get an overall total. e.g. Dept Number Number of Hours 151 4 151 4 151 1 132 6 132 2 151 4 144 8 144 3 132 1 How do i sum all the numbers of hours for dep...

Track a part was used in what serial #
Hi anyone can help me. I know how to track the specific parts we used in a product if we know the serial #. The other way round, How can we track the what serial numbers contain a special part number. For example, if we product 100 serial number tracking unit by using 300-0000 part when we build the picking list. later, how could we know which product using this 300-0000 part? Thank you very much! -- Lucy ...

Nested IF & Nested AND
I'm trying to compare two cells to create two different outcomes. The formula I'm using is as follows; =IF((AND(H15="Capitol",I15="both")),F15/2,),IF((AND(H15="Capitol",I15="MPL41")),F15,) Cell H15 does equal Capitol, Cell I15 does equal both, Cell F15 does equal $3,094.36. When I use this formula I get the correct answer of $1,547.18 =IF((AND(H15="Capitol",I15="both")),F15/2,) When I try to nest another IF as shown above I get the error #value!. By adding the IF((AND(H15="Capitol",I15="MPL41")),F15,) I...

Question regarding the simultaneous use of tape drives
Hi folks, a customer of us wants to use DPM instead of their current Symantec solution. A question I coudn't answer was if they could use their 6-drive tape-robot to for example backing up and restoring at the same time. Thank you in advance for your support! -- Christoph Schmidt || IT Consultant @ TOP TECHNOLOGIES CONSULTING || MCITP EA If there 6 drives available in a library 6 tape related jobs can be run in parallel at any time. Thanks, Praveen D [MSFT] This posting is provided "AS IS" with no warranties, and confers no rights. "Christop...

Nested Groups
We have nested groups (specialty areas) inside of a main discipline group. All groups are set to expand on the local server. We are experiencing issues with using this main group to assign permissions on Public Folders and to set it as allowed sender for message restrictions for other distribution groups. Has anyone come across this before? Does anyone know of a fix? Are these mail-enabled Security Groups? -- Bharat Suneja MCSE, MCT blog: ----------------------------------------- "Heather Arnot" <

Nested IF
How can I overcome the limitation of having up to only 7 levels of nested IF functions? I want to display a name in a cell that corresponds to a number in another cell, and I have 16 numbers. e.g. =If(A1=1,"Name1",If(A2=2,"Name2",If(... how about using choose or vlookup =choose(a1,"name1","name2",etc) "Amjad" <> wrote in message news:044b01c37255$9b8a13d0$a301280a@phx.gbl... > How can I overcome the limitation of having up to only 7 > levels of nested IF functions? > I want to display a name in a cell ...

How to create nested nodes in XML in C#
Hi, I have to create an XML in the following syntax: <RESPONSE> <QueueItems> <Node1>..... <Node2>..... </QueueItems> <QueueItems> ... </QueueItems> </RESPONSE> Iam building this through a SqlDataReader object. My problem is I cannot get DOM object to create the QueueItems node. Please help! TIA Ramya Ramya A wrote: > I have to create an XML in the following syntax: > > <RESPONSE> > <QueueItems> > <Node1>..... > <Node2&...

Internet : Learn How To Use It .
Internet : Learn How To Use It . Features : E-Mail . Chatting . Upload , Download and Share . Blog or website creation . Earning schemes . Check all of these in one place at Thank You . ...

How do use outlook express to send email in office 2003
I upgraded my ofice xp to office 2003 and i've been using outlook express 6 for my emails.After installing office 2003 I can not send email from any office application,I can launch and put in the email address but the send button does not appear anywhere.Please help Hi Look at number 2 and post back with the result please -- Regards Ron de Bruin "How do use outlook express to send email" <How do use outlook express to send> wrote in message news:7B9F5AD1-07F3-4297-B...

All, I need a "no-kidding" online MS Access programming class. Please help me. I want to start from the beginner to the decent level of programming. Thank you in advance, Alish ...

I have read several posts regarding nesting, but I haven't quite found what has perplexed me for the last couple of hours. I'm using a set of IF functions to check 12 different cells to see if they match a particular cell. If it does, it returns a value of a different cell, if false it returns zero. These are contained within a SUM function. Now, here is the perplexing part. They aren't "nested" per se, because they are all on the same level. I can get it to work by checking up to 11 of the cells, but on the 12th, it breaks. Here is the formula with only the 11 entries...

Does anyone know if I can rebuild mfc class
Hi, I am trying make some changes to dbcore.cpp file and rebuild it. Does anyone know if I can do that or not. thank, Hallo Bhavin! > I am trying make some changes to dbcore.cpp file and rebuild it. Does > anyone know if I can do that or not. 3 possibilities: 1. Make the change, create a new static build on your machine and link your MFC program statical. 2. Create your private MFCnn.DLL build with a different name and your change. you find the fully documented makefiles in the MFC SRC directory. But BTW, you need to do some changes here if you change the name. (T...

Nested groups
Hi, It seems to me W2K8 R2 has problems regarding file and folders permissions and nested groups. Our domain has a mix of W2K8 R2 and W2K3 DCs. From a RDP session on a member server itself, I try to browse to a folder where the local "Administrators" group has full control. The "Domain Admins" group is in the local "Administrators" group and my user is in the "Domain Admins" group. However, when I double-click the folder, I get this dialog box "You don't currently have permission to access this folder". If I click "C...

Using IF for conditional formatting?
Need help with displaying blank cells when formulas are inside. The formulas would display a value if the contents of a source cell is filled in. I'm attempting to use in the formula cells(like B2): IF(A2="","",A2*5) If A2 is null, then display blank in B2, else calculate A2 * 5. Is this the best approach to keeping formula cells clear until data is entered? Thanks!!!! Yes -- For everyone's benefit keep the discussion in the newsgroup. Regards, Peo Sjoblom "Barb" <> wrote in message news:fd0201c4...

I am trying to create an "if" formula to check cells in a particular column for different texts, but it only lets me add 7 before getting an error that I have exceeded the limit for nesting in the current file format. How do I work around this? =IF(D4378="LUNCH/OFFICER",O4378,IF(D4378="INFORMATION",O4378,IF(D4378="BUSY",O4378,IF(D4378="DETAIL",O4378,IF(D4378="END OF DUTY",O4378,IF(D4378="EQUIPMENT",O4378,IF(D4378="FUEL",O4378,IF(D4378="LIDAR CALIBRATION",O4378,"")))))))) Try: ...

templated class
Hi, I would need some help to write a templated function or method. I am developping a GUI and on one plateform I am using a listbox (CListBox) while on the other it's a combobox(CCombobox). Both controls derived from a the same base class CWnd like this : class CComboBox : public CWnd { .... int AddString(LPCTSTR lpszString); } class CListBox : public CWnd { .... int AddString(LPCTSTR lpszItem); } in my dialog I would like to write a method that take a CComboBox or a CListBox and call the AddString method. class CMyDialog : public CDialog { // take a CListBox or CCombobox templa...

use current month in ad If satament
I have a cell A1 with a drop down to select month. In another cell on another sheet I want to compare the current month to the value in A1. If (current month = A1, value, value) I've found a lot of date functions but the solution evades me. Can someone please help me? All I really need is how to get the month to use to compare I think I have the rest of the formla figured out. TIA gls858 I'm not sure what you're really using -- dates or the month names? I'm guessing names like January, February, ..., December. =if(text(today(),"mmmm")=A1,"...

VLOOKUP Nesting Formulas #2
When I say "there" I mean the data range I'm searching. I'm starting t think that a vlookup isn't the way I should be going. The purpose o this formula is to tell me if a specific item number that is on specific purchase order is on a boat from China yet. Container PO# Part# Cases Pieces CAXU9144316 P900686 66701 215 2,580 P900608 68301 615 7,380 P900686 68301 1267 15,204 P900686 69501 74 888 P900686 77501B 9 432 P900686 77901 145 580 I could be looking for item #77001 that is on PO#P900686, but if don't specify in the formula both numbers have to exist...

Changing between share classes for Vanguard Mutual Funds
I am using Money 2004 H&B, have 2006 Deluxe - but have not made the switch. I can't figure out how to handle a transaction. Vanguard has two classes of some of their mutual funds (investor and admiral). You can transition between the two as a non-taxable event - based on certain account requirements. The transition on is handled as a Shares-Out/Shares-In on my statement - there are different quantity of shares and different share prices for each class. The total $ transferred is equal on both ends of the conversion. What is a good way to handle this in Money? Shares-Out/Shares-I...

Using time values with an IF
Hi all, Is it possible to use hours and minutes (hh:mm) as the parameters in an IF statement. Regarding the formula below; =IF(ISBLANK(E20),"",IF(E13<9,"Rest",IF(E13<11,1,"OK"))) The values in cell E13 is in hh:mm format, and as such the formula doesn't compute. I've tried changing the number 9 and 11 in the example above to 09:00 00:09:00 #09:00# "09:00" Without any success. Can anyone please help me out with the correct syntax or suggest an alternative - note I cannot change the cell format from hh:mm Thank you, Colin. ...

Using global variable in criteria
Hello, I'm trying to save a query that will test to see if there are two global variables set up or not. If there is a value in the variable, I will use it as criteria; if not, no. My first problem comes when trying to use the variable. I found this on this site: >Queries don't have direct access to VBA variables, global or not. You >need to write a dumb little wrapper function: > >Public Function GetGlobal(varname as string) As Variant >GetGlobal = Eval(varname) >End Function > >If the variable is named glUsername, you'ld put >GetGlobal("glUsern...

Nested if/and
trying to exceed the if statement max in excel 2000. I don't have the experience necessary to write a function in vba. Can someone please help me. This is what I am trying to accomplish. I have 40 worksheets set up as bonus reviews. The review bonus dollar amounts are based on the number of hours worked and the performance score. Here is a shot in the dark at what I need in the vba module. If $B$7 >1000 AND $C$13 = "Good" Then 200 ElseIf $B$7 >1000 AND $C$13 = "Excel" Then 400 ElseIf $B$7 >1000 AND $C$13 = "Outst" Then 500 Elself $B$7...

how to set up a repeating a phrase used often
I want to be able to insert a phrase which I often use by pressing a key. See Hope it helps -- Brian McCaffery "Patshubby" wrote: > I want to be able to insert a phrase which I often use by pressing a key. See -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA "Patshubby" <> wrote in message