?
Solved

#import

Posted on 2001-06-07
17
Medium Priority
?
494 Views
Last Modified: 2013-11-20
Hi,
I use vc6++,w2k
in stdafx.h after last #include
I add:
#import "c:\winnt\system32\cdosys.dll" no_namespace

but 37 errors after F7
Why
0
Comment
Question by:plamtod
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 4
  • 2
  • +1
17 Comments
 

Expert Comment

by:sgupta00
ID: 6164630
Try this

#import <cdo.dll> no_namespace
 
and make sure that this dll is found or else you will get the error .... no such file or directory.
0
 
LVL 1

Expert Comment

by:timop
ID: 6164684
In the file "cdosys.tlh" you can find the comment:

// Cross-referenced type libraries:
//
//  #import "E:\Program Files\Common Files\System\ADO\msado25.tlb"
//

At first, you have to import this type library.
0
 

Author Comment

by:plamtod
ID: 6164875
Nither cdo.dll nor
#import "c:\Program Files\Common Files\System\ADO\msado15.tlb"
work!

0
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 

Expert Comment

by:sgupta00
ID: 6165013
what error do you get if you replace

#import "c:\winnt\system32\cdosys.dll" no_namespace

with

#import <cdo.dll> no_namespace

0
 

Author Comment

by:plamtod
ID: 6165056
24 errors
first is
error C2367: 'Folder' : redefinition;
I read that for w2k type lib is cdosys.dll
0
 

Author Comment

by:plamtod
ID: 6165064
Try new dlg based app and add #import "cdo.dll" in atdafx.h
It doesn't work
0
 

Author Comment

by:plamtod
ID: 6165078
Try new dlg based app and add #import "cdo.dll" in atdafx.h
It doesn't work
0
 

Expert Comment

by:sgupta00
ID: 6165090
Yeah, I remember that error, got it too long time ago. I think what I did was go to file on which Folder redefinition error is and comment one of the definitions.
0
 

Author Comment

by:plamtod
ID: 6165126
After redefinition errors are "not a member of 'Folder'"
Are you sure I have not to use cdosys.dll and I think that for new project there no reason not to work
0
 

Expert Comment

by:sgupta00
ID: 6166050
OK try this and see if it works

#import "c:\winnt\system32\cdosys.dll"   no_namespace raw_interfaces_only
0
 

Author Comment

by:plamtod
ID: 6166546
It works but if I'd like to use smart pointers?
It must have some way!
0
 

Author Comment

by:plamtod
ID: 6166592
If I use cdosys.dll without no_namespace raw_interfaces_only
 errors are:
missing storage class and ";"
0
 

Author Comment

by:plamtod
ID: 6166762
O.K. if I add import ado, cdo work without raw_interfaces_only
0
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 6171408
the following worked for me

#import "C:\Program Files\Common Files\System\ADO\msado25.tlb" no_namespace raw_interfaces_only
#import "c:\windows\system32\cdosys.dll" no_namespace
0
 

Author Comment

by:plamtod
ID: 6175950
It's work but next warning follow:
warning C4146: unary minus operator applied to unsigned type, result still unsigned
and

1)IMessagePtr iMsg(__uuidof(Message));

2)iMsg->To = "ptodorov@zgb.bg";
3)iMsg->Send();

at 1st raw -> exception in kernel32.dll
It compiles but does't work
0
 
LVL 9

Accepted Solution

by:
ShaunWilde earned 150 total points
ID: 6176272
> warning C4146: unary minus operator applied to unsigned type, result still unsigned

you can ignore this

try - I think your string should be a BSTR

1)IMessagePtr iMsg(__uuidof(Message));

2)iMsg->PutTo(CComBSTR("ptodorov@zgb.bg")); // or put_To - see your .tlh
3)iMsg->Send();



0
 

Author Comment

by:plamtod
ID: 6190054
I create new dlg app.
and in stdafx.h
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" no_namespace raw_interfaces_only
#import "c:\windows\system32\cdosys.dll" no_namespace

void CErDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
     // TODO: Add your message handler code here and/or call default
CoInitialize(NULL);

IMessagePtr iMsg(__uuidof(Message));
iMsg->From     = "ptodorov@zgb.bg";
iMsg->To       = "ptodorov@zgb.bg";
iMsg->Subject  = "Your lights are on, but no one is home";
iMsg->TextBody = "You left your lights on this morning.";
iMsg->Send();
CoUninitialize();
CDialog::OnLButtonDown(nFlags, point);
}
It doesn't work.
on send() say:"The memory couldn't be read"

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question