|
The documentation for programming Outlook via C++ is very poor. Try searching MSDN for "Microsoft Office 2000 Language Reference" which gives details of Outlook object model (in VB, but it's better than nothing).
Also try looking in the Knowledge Base for article 196776.
|
|
|
|
|
I recently had to do the same thing (retrieving message objects from the user's inbox), and I used two tools: one was doing a google search on words related to what I was trying to do. the other was using the outlook helpfile that should be on your machine 'VBAOUTL9.chm'; that helped me more than anything. If there's anything specific, post it and i'll see if there's a way I can help
If it's broken, I probably did it
bdiamond
|
|
|
|
|
I've manage to created wrapperclasses and starting using automation. (I'm not really sure what it means but anyway).
I manage to run this code:
...<br />
if(!app.CreateDispatch("Outlook.Application"))<br />
{<br />
AfxMessageBox("Couldn't start Outlook.");<br />
}<br />
else <br />
{<br />
app.Quit();
}<br />
and Outlook closes if I have it open. But I don't know how to for e.g. start Ouutlook, create a mailmessage, fill To, Subject and Body and then send it using “this automation stuff”.
Thanks
_____________________________
...and justice for all
APe
|
|
|
|
|
well, I never actually sent the messages myself, but here's some code I used to get the messages from the user's inbox and populate the listview I have in my dialog box:
void COtestDlg::PopulateLVW()
{
MAPIFolder folderInbox;
Recipients recs;
Recipient rec;
_NameSpace ns;
_Items itemsMessages;
_MailItem mi;
_MailItem mReply;
_Application app;
try
{
if(!app.CreateDispatch("Outlook.Application"))
{
AfxMessageBox("Couldn't start Outlook.");
}
else
{
ns = app.GetNamespace("MAPI");
COleVariant vt;
COleVariant vtOptional("");
COleVariant vtTrue;
vt.ChangeType(VT_BOOL);
vt.boolVal = true;
vt.ChangeType(VT_I2,NULL);
ns.Logon(vtOptional, vtOptional, vtTrue, vtTrue);
folderInbox = ns.GetDefaultFolder(6);
itemsMessages = folderInbox.GetItems();
aMessages = new CMessageItem[itemsMessages.GetCount()];
for (int x = 0; x < itemsMessages.GetCount(); x++)
{
mi = itemsMessages.Item(COleVariant((long) x + 1L));
mReply = mi.Reply();
recs = mReply.GetRecipients();
rec = recs.Item(COleVariant((long) 1L));
CString address = rec.GetAddress();
aMessages[x].m_strBody = mi.GetBody();
aMessages[x].m_strEmailAddress = address;
aMessages[x].m_strEntryID = mi.GetEntryID();
aMessages[x].m_strHTMLBody = mi.GetHTMLBody();
aMessages[x].m_strSubject = mi.GetSubject();
CString strBody = mi.GetBody();
strBody.Replace("\r\n"," ");
strBody = strBody.Left(50);
m_lvwResults.InsertItem(x,address);
m_lvwResults.SetItemText(x,1,mi.GetSubject());
m_lvwResults.SetItemText(x,2,strBody);
m_lvwResults.SetItemData(x,x);
}
CString strCount;
strCount.Format("%d",m_lvwResults.GetItemCount());
m_lblCount.SetWindowText(strCount);
ns.Logoff();
}
}
catch(...)
{
AfxMessageBox("There has been an error.",MB_ICONINFORMATION);
}
}
I hope this helps in any way
If it's broken, I probably did it
bdiamond
|
|
|
|
|
THANKS!! Your code made me think a bit and found out these simple lines to send a message:
_MailItem mail = app.CreateItem( 0 );
mail.SetTo( "blubb@syd.kth.se" );<br />
mail.SetSubject( "Mail from VC++ automation" );<br />
mail.SetBody( "The BODY" );<br />
mail.Send();<br />
but still I'd like to find any MS Outlook C++ Reference somewhere. I googeld but no success.
_____________________________
...and justice for all
APe
|
|
|
|
|
hi,
i got Doc/View app with database queries.
in which function in the Doc should i do the query?
Avi
|
|
|
|
|
Avi Laviad wrote:
in which function in the Doc should i do the query?
Qué?
You can place your queries anywhere you like. Whether the appropriate place to put yor DB queries is in the Document, View or even the Application class is up to your program's design.
Maybe you should read up a little bit more on the
Doc/View[^] architecture to help answer your question.
I Dream of Absolute Zero
|
|
|
|
|
PROBLEM
Unable to understand the variation in size of object
All the code is tested under Borland C++ ver 3.1
In borland V3.1 the int takes two bytes
Lets look at the following code
Class base<br />
{<br />
public:<br />
int b;<br />
base()<br />
{}<br />
virtual void f() {}<br />
virtual void g() {}<br />
};<br />
Class derive : virtual public base<br />
{<br />
public:<br />
int d;<br />
derive()<br />
{}<br />
virtual void f() {}<br />
virtual void g() {}<br />
};
………………
derive d;
cout<<sizeof(d); <b="">gives 12 why?
/*
But if I don’t give constructors in derive then the size of derive class object is 10, because there will be no 2 bytes extra in object layout as shown below. Please help me out about finding the myth of these extra two bytes.
*/
Object-Layout V-TABLE
|------------| |------------|
---|ptr to base | -->|derive::f |
| |------------| | |------------|
| |derive v-ptr|-------| |derive::k |
| |------------| |------------|
| |d | ->|derive::f |
| |------------| | |------------|
| |0 |<-- | |base::g |
| |------------| | | |------------|
-->|base-vptr |---|----|
|------------| |
|b | |
|------------| |<small>what the hell is this</small>
Please reply at:
Contact: informfarid@yahoo.com
------------------------------------------------------------
In the middle of dificulty lies oppurtunity.
|
|
|
|
|
Can I ask why you need to know? A compiler is at liberty to decide how to layout a class - the C++ standard doesnt define this. I recall finding a description of different methods on the net, so you should be able to find the details from google. I would imagine the extra byte is for some internal use by the Borland compiler, or maybe even just for padding. Either way, you shouldnt base code upon the size of an object, as compilers will give different sizes.
|
|
|
|
|
2 extra bytes meanse shortage of ram
Even if there is know reason one should know the myth of this mystry
------------------------------------------------------------You miss 100% of shots that u dont take.
|
|
|
|
|
Saving 2 bytes! You must be kidding - for a 1 000 instances of the class, this means (less than) a meagre 2 kbs of wasted space. This is not uncommon - "wasting" memory, that is - struct s will be padded, for example, for reasons of performance.
You should just leave this to the compiler-writers, madness lies in this direction
|
|
|
|
|
I think it's related to your use of virtual inheritance. What's your reason for making the inheritance relationship 'virtual'?
Paul
|
|
|
|
|
It may have everything to do with keeping VTables on 4-byte boundaries.
Since VTables will resolve into pointers to functions in derived classes, they want to keep them aligned so the performance on the CPU is better.
As an experiment, you can try changing
public:
int b;
base()
into
public:
byte b;
base()
And you will still probably get 12.
Then try
public:
int b;
int c;
base()
And you might still get 12.
I think it has do do with optimizing pointers to tables of function pointers, myself.
|
|
|
|
|
Hello Guys,
How ru doing, I need some help in FTP, first i will clearly explain u the situation.....
i have one one FTP user login, i have logged into the FTP server with that login, now by code i need to know how much space like .... The total space allocated for the user, the space occupied by the user, and the remaining space.
currently i have one solution...but its not working fine...i.e i can execute a FTP command through code like "ls", doing this will return a string to me containing the result(text string) for the executed command. the problem here is this is not working all the time....if the data commection is lost it just hangs offff and many other problems are there.
guys plz help me out of this problem....waiting for the solution
|
|
|
|
|
in UNI*/perl
<br />
$dir = "/myserver/mydir";<br />
$aa=qx(du -s -k -m $dir);<br />
print "<BR>size of website in MB $aa<BR>";
in FTP I think your only solution is to manually recurse through all the subdirectories geting the size of each file, if you are using the MFC CFtpFileFind is one solution
"Laughing at our mistakes can lengthen our own life. Laughing at someone else's can shorten it."
- Cullen Hightower
|
|
|
|
|
Ted...thanks for ur reply man...
Actually the Server which iam going to connect is Windows wunning Windows Media Server
as u said iam able to get the size of the files in the server...but i need one more thing...i.e the maximum space allocated for the user...i.e in my application i upload some as per the user request...when uploading the file, i should the left out empty space for the user..if its less then i have stop the upload ...this is the scenario....got it fed....can u help me out of this solution
|
|
|
|
|
Sorry can't help you there.
"Laughing at our mistakes can lengthen our own life. Laughing at someone else's can shorten it."
- Cullen Hightower
|
|
|
|
|
Hi.
I am new to MFC/VC++.
please guide me.
I create three -page on a property sheet like page1,page2 and page3.page1 contains three text box which take integer value.Now. I create three member variable of int type like
m_nText1
m_nText2
m_nText3
I would like to do that when I click On 'OK' button on a proerty sheet.It should add two integer values(m_nText1+m_nText2) and display in the third text box(m_nText3).I want to do through constructor.
Any help appriciated
Thanks
rajesh
|
|
|
|
|
When you click the property sheet OK button it will close the property sheet.
I suggest you do something like this:
1) Add a button to your page called "Calculate" for want of a better name.
2) Add the appropriate handler for the button press BN_CLICKED.
3) In the button handler code, add your values and set the third control.
When you press the calculate button you will then see the result.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
|
i m using VC++ n Access as Database
if i m using hard code values of date n month n year its gives result fine
as query is
rs->Open(AFX_DB_USE_DEFAULT_TYPE, "SELECT * FROM Record WHERE (([Record].[Date] Between #9/27/2001# And #7/30/2004#))");
But i wanaa use values of date . year n month that r input by user .. in form of String or integer in variables .. m_date . m_month .. and m_year.
how can i use these variables values in Query now
i used like this but Wrong Query message appears
rs->Open(AFX_DB_USE_DEFAULT_TYPE, "SELECT * FROM Record WHERE (([Record].[Date] Between #m_month/m_date/m_year# And #m_month1/m_date1/m_year1#))");
I also Tried by TO_Date Function ,, but its said undefined function
how can i do it by user values ..
thanx
|
|
|
|
|
Anonymous wrote:
i used like this but Wrong Query message appears
rs->Open(AFX_DB_USE_DEFAULT_TYPE, "SELECT * FROM Record WHERE (([Record].[Date] Between #m_month/m_date/m_year# And #m_month1/m_date1/m_year1#))");
You have the right idea here. First create a valid SQL string, using the variables that you have set up for user input.
So if you have the int variables: m_monthx, m_datex and m_yearx. Then all you have to do is modify your code like:
<code>
CString strSQL.
<font color=green>
strSQL.Format(_T("SELECT * FROM Record WHERE (([Record].[Date] Between #%d/%d/%d# And #%d/%d/%d#))"),
m_month1, m_date1, m_year1, m_month2, m_date2, m_year2);
<font color=green>
rs->Open(AFX_DB_USE_DEFAULT_TYPE, (LPCTSTR)strSQL);
</code>
I Dream of Absolute Zero
|
|
|
|
|
I have a menu "Options" with one submenu "Start"
Options>Start
How can i change the caption of "Start" to "Stop" when i click the menu?
|
|
|
|
|
Handle the ON_UPDATE_COMMAND_UI event for your "Start"/"Stop" menu item and then in that handler function something along the lines of...
if(bStartMode)
pCmdUI->SetText("Start");
else
pCmdUI->SetText("Stop");
You could have code in the ON_COMMAND event handler to toggle the mode from start to stop. Hope this helps.
Happy Programming and God Bless!
"Your coding practices might be buggy, but your code is always right."
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
I tried that, but i doesnt work. I'm using VC++6 with SP5 and my program is a dialog based program.
<br />
void CTestUImageDlg::OnUpdateFileExit(CCmdUI* pCmdUI) <br />
{<br />
pCmdUI->SetText("Start");<br />
}<br />
Nothing happens!
Why??!!
|
|
|
|