#import

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
plamtodAsked:
Who is Participating?
 
ShaunWildeCommented:
> 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
 
sgupta00Commented:
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
 
timopCommented:
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
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
plamtodAuthor Commented:
Nither cdo.dll nor
#import "c:\Program Files\Common Files\System\ADO\msado15.tlb"
work!

0
 
sgupta00Commented:
what error do you get if you replace

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

with

#import <cdo.dll> no_namespace

0
 
plamtodAuthor Commented:
24 errors
first is
error C2367: 'Folder' : redefinition;
I read that for w2k type lib is cdosys.dll
0
 
plamtodAuthor Commented:
Try new dlg based app and add #import "cdo.dll" in atdafx.h
It doesn't work
0
 
plamtodAuthor Commented:
Try new dlg based app and add #import "cdo.dll" in atdafx.h
It doesn't work
0
 
sgupta00Commented:
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
 
plamtodAuthor Commented:
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
 
sgupta00Commented:
OK try this and see if it works

#import "c:\winnt\system32\cdosys.dll"   no_namespace raw_interfaces_only
0
 
plamtodAuthor Commented:
It works but if I'd like to use smart pointers?
It must have some way!
0
 
plamtodAuthor Commented:
If I use cdosys.dll without no_namespace raw_interfaces_only
 errors are:
missing storage class and ";"
0
 
plamtodAuthor Commented:
O.K. if I add import ado, cdo work without raw_interfaces_only
0
 
ShaunWildeCommented:
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
 
plamtodAuthor Commented:
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
 
plamtodAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.