How to solve this question?

Hello all:
      I write a component using ATL and it includes two interface:ISMath and
IAMath,
and now I write client codes and want to the file tlb,Look:
#import "Com_01.tlb" no_namespace
#include <windows.h>
#include <iostream.h>

void main()
{
   HRESULT hr;
   hr=CoInitialize(NULL);
    if(FAILED(hr))
 {
  cout<<"Initialize COM failed"<<endl;
        return;
 }

   ISMathPtr spSFun;
   IAMathPtr spAFun;
   spSFun.CreateInstance(L"Com_01.SMath");
   long  s=spSFun->Add(11,12);
   cout<<s<<endl;
   spSFun.QueryInterface(IID_IAMath,spAFun);//It displays this sentence is
error
   s=spAFun->Sub(22,11);
   cout<<s<<endl;
   spSFun.Release();
   spAFun.Release();
   CoUninitialize();
}
I compile and it displays: 'IID_IAMath' : undeclared identifier,why?how to
do?
Thanks very much.


0
fbjlt (155)
4/9/2007 12:04:17 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
738 Views

Similar Articles

[PageSpeed] 46

On Apr 9, 8:04 am, "Lee Tow" <f...@pub3.fz.fj.cn> wrote:
> Hello all:
>       I write a component using ATL and it includes two interface:ISMath and
> IAMath,
> and now I write client codes and want to the file tlb,Look:
> #import "Com_01.tlb" no_namespace
> #include <windows.h>
> #include <iostream.h>
>
> void main()
> {
>    HRESULT hr;
>    hr=CoInitialize(NULL);
>     if(FAILED(hr))
>  {
>   cout<<"Initialize COM failed"<<endl;
>         return;
>  }
>
>    ISMathPtr spSFun;
>    IAMathPtr spAFun;
>    spSFun.CreateInstance(L"Com_01.SMath");
>    long  s=spSFun->Add(11,12);
>    cout<<s<<endl;
>    spSFun.QueryInterface(IID_IAMath,spAFun);//It displays this sentence is
> error
>    s=spAFun->Sub(22,11);
>    cout<<s<<endl;
>    spSFun.Release();
>    spAFun.Release();
>    CoUninitialize();}
>
> I compile and it displays: 'IID_IAMath' : undeclared identifier,why?how to
> do?
> Thanks very much.


Looks like this interface is not included in .tlh/.tli files. Check
those generated files for this interface. Also, post his in a ATL
newsgroup for suitable responses.

---
Ajay

0
ajaykalra (6842)
4/9/2007 7:14:32 PM
Reply:

Similar Artilces:

Office 2K XL question please
I want to do an FFT on some data so in the HELP system I find I must install the Analysis ToolPak. It even tells me how to install it: "To install the Analysis ToolPak On the Tools menu, click Add-Ins. " Only problem is that there's no TOOLS on my menu. My top menu items are FILE EDIT VIEW INSERT FORMAT DATA WINDOW HELP. I looked everywhere for some other menu with TOOLS in it with no luck. I did find a "Toolbar" but I saw nothing about any Analysis or Add-Ins. If I ever get it installed, I'll need the TOOLS menu again for the HELP tells how to use it: &q...

Re: Question from an Idiot
Sorry, sent to wrong group. -- ------------------------------------------ Jeffrey Needle jeff.needle@gmail.com "Jeff Needle" <jeff.needle@cwnet.com> wrote in message news:... > Yes, I think I've asked this before, but my brain has lost the > information. > > Does anyone here use Outlook Express Quick Backup? If so, can you tell me > if I can back up to a USB stick, and then carry the stick to another > computer, restore the data, and use my OE data? I'll be traveling soon, > and I need this ability. > > Thanks. > > -- > &g...

Excel Header questions
Howdy all, I have a question for you all, we want to put our company logo on an excel spread sheet but only on page 1. When we insert the header it puts it on all of the pages. Does anyone know how to stop this from happening? James Only through VBA unless you print out just the first page in one print job then the rest of pages in second print job. See Ron de Bruin's site for VBA code. You will have to adapt his code for your situation but easily done. http://www.rondebruin.nl/print.htm#Header Gord Dibben MS Excel MVP On 3 Jul 2006 08:15:23 -0700, "James KA" <James...

Why don't my questions appear in this forum?
I've posted the same question two days in a row but when i return to look for my posts they are not there. Dan Crossett wrote: > I've posted the same question two days in a row but when i return to look for > my posts they are not there. They're there; I see two threads of what appears to be the same question w/ different subject lines. -- "Dan Crossett" <DanCrossett@discussions.microsoft.com> wrote in message news:2CC515A1-31A0-4E2A-9AE1-964A696ABE5B@microsoft.com... > I've posted the same question two days in a row but when i ret...

Help - another question related to rules
Hi: I do seem to be experiencing difficulties with rules these days....... I created a rule that includes having the server respond with a specific message (in fact, all the rule does is to have the server respond with a particular message). The rule is working - I know that since I can sent a test message and receive the appropriate response back. The problem is that there is nothing in the account to indicate that the response was actually sent - I would have thought that the sent messages would show up in my sent messages folder. Am I doing something wrong. Can anyone shed some ...

AUTORUN.INF Problem Solved
You were helping me try to get MS Money trial version installed earlier this week. I was getting the following message during installation: "The AUTORUN.INF file is missing or corrupt." I have found the cause, corrected it, and have installed MS Money. A few weeks ago an article in "Windows Secrets" (published by Brian Livingstone and Fred Langa) had an article regarding a patch for the registry to prevent certain malware programs from running automatically via uSB drives etc. I installed that patch, which disabled AUTORUN capabilities in many instances. I had comp...

Calendar Problems afte Migration Question
Hello, We migrated from Exchange 5.5 to Exchange 2003 Interorg. Did not successfully get Free / Busy replicated during migration but users lived with it. We are now fully migrated minus turning off old server. The smtp setup during migration was / is : mail comes in from internet to smtp appliance , delivers to new 2003 server, hands off to old sever if no mailbox, old server handles all smtp traffic to internet via connector. Now all the mailboxes are on the new server. We are having intermittent delivery failures and calendar issues. (Users cant see free busy of users on same serv...

CRM 3.0 Reporting Questions
I am preparing for an upgrade to 3.0, and I am working on a test server right now. I can run the canned reports without a problem, but we have come custom reports that will need to be re-created for SQL Reporting. I am not familiar with this, so I was hoping to get some insight on required components. Do I need to install additional software on the CRM/SQL box or is the extra stuff needed on a client pc? Hi: SRS will install with v3.0, and I have a hands-on-lab on my blog that goes through creating new reports in SRS and Visual Studio. http://blogs.msdn.com/jstraumann. -- John [MSFT...

Mapping question 02-02-05
Hi All! I want to add on account form new field that mapped to some user. Something exactly like "owner". I've looked through Development Manager and could find a way. Can I? If so need step by step assistance. Thanx for advance. you mean you want to add a field that allows you to choose a user? Lookup fields cannot be added to crm. -- John O'Donnell Microsoft CRM MVP http://www.mscrmfaq.us "Andrey Ptashinskiy" <ptash@mail.ru> wrote in message news:1107358906.599467.57490@f14g2000cwb.googlegroups.com... > Hi All! > I want to add on account form new...

Worksheet properties question
Is there a way to extract info that is in the File>Properties box such as subject or author, and place it into the worksheet? What I really want to do is have the value in a custom field in the Properties box, show up on a worksheet cell. Thanks, Diane Have a look at Chip Pearson's page regarding this. http://www.cpearson.com/excel/docprop.htm Diane K wrote: > Is there a way to extract info that is in the File>Properties box such as > subject or author, and place it into the worksheet? What I really want to do > is have the value in a custom field in the Properties b...

newsreader question
is there any way to point a desktop shortcut to the newsreader part of OE w/o opening OE itself. there are time I just want to read newsgroups and want to avoid opening outlook 2003 (which I like BTW) then hitting news button. If I knew specifically where the news button pointed to I might be able to figure it out from there. any help appreciated -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 100,000 Newsgroups - 19 Different Servers! =----- create a shortcut to msmin.exe /outnews. this will o...

Newbie MFC Question
Hi All, I'm new to MFC and have a quick couple of questions. I have an MFC app that opens a resource when the app is started ( in InitInstance()) and closes the resource when the app exits (in ExitInstance()). I want to "share" this resource with the View class. How do I reference this resource (which is a property of my main MFC App) from the view class? Also, this resource (a graphics lib that uses opengl) needs to draw to the screen. I am trying to do that by drawing to the device context of the m_pMainWnd property of the MFC application but this doesn't seem to be worki...

Upgrade Question #2
My father currently uses Money 2004 Deluxe. He's interested in upgrading to Money 2006, but to the Standard version. Will Money 2006 Standard open a Money 2004 Deluxe data file? Thanks, --David Ehrlich It's supposed to. The difference in price is miniscule. 2006 Deluxe license was going for $18.84 or so at Sam's Club last I looked. Why mess with Standard? "David Ehrlich" <djehrlich@hotmail.com> wrote in message news:OOMa9IfAGHA.3596@TK2MSFTNGP10.phx.gbl... > My father currently uses Money 2004 Deluxe. He's interested in upgrading > to Money ...

CURSOR_STATUS question
I was having trouble with this earlier, thought I solved it but then trouble again. I want to create the following: DECLARE crBadAdjs INSENSITIVE CURSOR FOR..... But I need to test it for CURSOR_STATUS which I don't seem to be able to do with INSENSITIVE because I don't know if it's local or global.. If I do the following, it works: IF CURSOR_STATUS('local', 'crBadAdjs') > 0 BEGIN CLOSE crBadAdjs DEALLOCATE crBadAdjs END DECLARE crBadAdjs CURSOR LOCAL FOR .... But if I use INSENSITIVE like this: DECLARE crBadAdjs INSENSI...

NameTable question
In my C# application I have an object model which can be loaded and saved into xml, not using serialization. When changes are made to the object model by the user interface, I use another thread to read the xml from the object model and run a transform on that xml. I have added locking code to the object model classes. I want to use the same NameTable throughout my app, and msdn says "NameTable implements a single-threaded XmlNameTable". Anyone know what that means? Thanks Colin Colin Savage wrote: > I want to use the same NameTable throughout my app, and msdn says "Na...

macro question :)
hello, folks =) i have a question about macros. i will explain what i'm trying/hoping to be able to do. i want to write a macro that will search for a particular value in a cell. when it finds that cell, i want to be able to copy a cell range with that cell as the upper left and 10 columns and 6 rows below that cell. for example, if i find the value in cell A6, i want to be able to select and copy the range A6:J11. then, that will be pasted into a different worksheet within that file. the last step would be to copy the cell that was found in that search, and paste that elsewhere. the pr...

CtreeCtrl question #2
Hello All, I wrote a class deriving from the CTreeCtrl.Then I define a var of this class and place the var in a COM.The tree comes into being.When the left Button clicked on the item,the tree can response the message.But when the left button double clicked,the tree can't response the message.What's the matter?What can I do? class CCustomTreeCtrl : public CTreeCtrl { ���� //{{AFX_MSG( CCustomTreeCtrl ) afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); afx_msg void OnLButtonDown( UINT iFlags, CPoint oPoint ); //}}AFX_MSG ���� } CCustomTreeCtrl m_customtree; ������...

dialog editor question
Can someone please help. I am trying to start the dialog editor. my book says :- 1 In microsoft excel for windows, choose Run from the microsoft excel control menu. 2 Select the dialog editor option button. 3 Choose the OK button. But I cannot find the excel control menu. Please can someone help? kind regards DAVE ...

Question about blocked email
I'm using Outlook 2003, and recently got an email back from the postmaster telling me that a certain message that I blocked could not be delivered. I'm confused, when I block a message, is there an email going to that sender telling them/him/her that I blocked it? I hope not...........Peter PeterM <pmaston@comcast.net> wrote: > I'm using Outlook 2003, and recently got an email back from the > postmaster telling me that a certain message that I blocked could not > be delivered. I'm confused, when I block a message, is there an email > going to that sende...

DC and DNS server question
Hi, I have promoted a member server to an DC, it's the 2nd DC in my zone. My question is in the dcpromote process, it didn't copy the DNS record from the Root DC to the 2nd DC. Is this normal? If not, how do I replicate the DNS record from the Root DC to the 2nd DC? Another question is do I need to config my Win XP client's 2nd DNS to the 2nd DC? Thanks for help. Jason Hello Jason, Is the first DC configured for AD integrated DNS zones? If not change to AD integrated zones, DNS management console forward/reverse lookup zone properties of the zone un...

Subform Code Question
I have a mainform (The One) and a subform (The Many) that displays data correctly. The problem: (The Many) can have one item or as many as nine or ten items and I need to be able to subtract an amount the user enters on the mainform from all of the subform items. The way I have it coded now it subtracts only the top or first item amount. How do you set-up a ‘Do While Not End Of File’ section of code in Access 2007? Thanks in advance -- KSmith KSmith wrote: >I have a mainform (The One) and a subform (The Many) that displays data >correctly. > >The pro...

CRM database collation question
Hello, In our CRM 3.0 test environment, I see that the CRM database collation is Latin1_General_CI_AS. However, our SQL 2005 box has the collation SQL_Latin1_General_CI_AS at the server level. Now, if I were to write a query such as the following: Select t.*, s.FullName From [customdatabase]..sometemptable t join OrgName_MSCRM..SystemUser s on t.username = s.DomainName I get the following error: cannot resolve the collation conflict between Latin1_General_CI_AS and SQL_Latin1_General_CI_AS in the equal to operation. So, I set my customdatabase collation to match the CRM database &...

Question about CreateFile
Sorry if this post is not relavent but I'm not sure which group to ask. I'm using CreateFile to open and write to a parallel port. My problem is that it always uses the same printer driver when printing and the job will not go to the 'default' driver. 'Default' meaning the printer that is set as default in printer properties. The spooler always shows the same printer name for the job. Even when I change the port for the driver to a different com port. I'm using xp Home. Does anyone know what might be happening? Hi Can you tell how are you usig the CreateFile , w...

Conditional Format Question
Suppose I have a cell or range of cells (formula or constant) formatted for numeric appearance, say two digit decimal. How would I apply conditional formatting to show the cell(s) as blank when its value = zero? -- PT Using Conditional Formatting: CF1: Cell value is equal to 0 Format1: <font>/<same color as background> Better: Use Custom Formatting: Format/Cells/Number/Custom 0.00;-0.00;;@ In article <eoC0EtTiHHA.4872@TK2MSFTNGP03.phx.gbl>, "PT" <xyz@xyz.com> wrote: > Suppose I have a cell or range of cells (formula or co...

formating formula question
I want to format a non-specific row if a condition is true. If the wor "final" is placed in a non-specific cell I want the entire row to b formated with a light green background and black alpha-numeric digits. Thank yo -- Message posted from http://www.ExcelForum.com Suppose you're evaluating rows 1-100 and "non-specific cell" means any cell in the row: 1. Select rows 1-100. 2. Go to Format > Conditional Formatting 3. Select "Formula Is" and insert: =OR(1:1="final") 4. Press the "Format" radio button and format as desired. ...