|
OK. I have this function:
STDMETHODIMP CAppEventListener::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* DispParams,
VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr) {
CMailItem MailItem;
MailItem.AttachDispatch( reinterpret_cast <idispatch*> (pDispParams->rgvarg->pdispVal) );
switch(dispIdMember)
{
case 0x0000f002:
{
AfxMessageBox( MailItem.get_Body() );
}
}
}
Please show me what I do incorrectly. I spent a couple hours with this and I don't know what to do.
|
|
|
|
|
Well, in order to get you going, here's a complete code-paste of a switch statement that catches an outgoing mail message and displays it in a message box:
const IID IID_IMailItem =
{0x00063034,0x0000,0x0000,{0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};<DIV>
.
.
.<DIV>
switch(dispIdMember)
{
case 0x0000f002:
{
IDispatch* pDisp = NULL;<DIV>
for ( UINT nIndex = 0; nIndex < pDispParams->cArgs; nIndex++ )
{
if ( pDispParams->rgvarg[nIndex].vt == VT_DISPATCH )
{
pDisp = pDispParams->rgvarg[1].pdispVal;
break;
}
}<DIV>
IUnknown* pMail;
HRESULT hr = pDisp->QueryInterface( IID_IMailItem, (void**)&pMail );<DIV>
if ( SUCCEEDED(hr) )
{
CMailItem MailItem;
MailItem.AttachDispatch( pDisp );<DIV>
CString csBody = MailItem.get_Body();<DIV>
AfxMessageBox( (LPCTSTR) csBody );
}<DIV>
pMail->Release(); pMail = NULL;<DIV>
break;
}
} I've tested this with my own Outlook XP (2002), and it captures outgoing mail messages correctly, and ignores other outgoing items. Copy the interface identifier to the start of the code file, and replace your switch statement with this code piece. Add a breakpoint, start Outlook, run the app in debug mode and observe the results. Although it works for me, it's not guaranteed to work for you out of the box, so be careful.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
How can I call the windows logon dialog to validate a user. Must be in c++/MFC not .NET.
Thanks.
|
|
|
|
|
Since the user has already logged on, why do it again? What exactly are you wanting to validate?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
|
- How do I create two windows with win32/CreateWindowEx but only one instance of the program (what I really want is just one icon on the taskbar - I assume they go hand in hand)? I want it to be an SDI application.
CreateDialogParam uses CreateWindowEx to create a modeless window without creating a new instance. What exactly is it in the way they call CreateWindowEx that makes it skip the part with the new instance?
- Can MDI child frames be floating outside the MDI client window?
(I hope this isn't off topic, didn't find a pure Win forum here).
/vanne
|
|
|
|
|
Not off-topic, but you've mistaken in several terms pretty badly.
Let's presume that you have an application. When you run it, Windows creates an instance of the application. This instance can create windows using CreateWindowEx . The windows created by CreateWindowEx are not "instances". They are called window objects, and belong to the instance of the application. So the question "what exactly is it in the way they call.." is illogical. There is no such way as the function doesn't create new instances.
Now, you can use the instructions in this article to limit your application to a single instance. Then create as many window objects as you need. Remember to destroy them afterwards, or you'll end up with memory leaks...
The MDI Child windows (child frames) cannot float outside the main MDI frame window. Microsoft calls this "Behaviour by design". It is designed to work this way, this is the idea of how it should work. If you need to change it, then MDI is not the approach you should use. Instead, just create multiple normal windows. They can float around the screen in any way you please.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
How I can know all the memory ram is it using my application? There are any function?
|
|
|
|
|
VietDelphi wrote:
How I can know all the memory ram is it using my application?
Read this article and see if you still want to ask that question.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
|
Sorry, but i need a function which i press a button it return me the current size of my process.
thanx you so much!
|
|
|
|
|
You're not going to find such a function. At best you'll get an approximation. When you alllocate and then deallocate memory, the amount "charged" to your application does not immediately go down. That's the point the article I pointed you to (near the bottom) was trying to make. For an example, see my reply here. You can also try walking your process' heap.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Does GetProcessWorkingSetSize() help? See MSDN for more info.
Bikram Singh
|
|
|
|
|
Hello! Everyone I am new to MFC programming So i was
wondering if it is possible to use Multiple Dialogs in an
MFC project?
Any links/tutorials will be helpful!
Thankyou for reading
$TELOPHASE$
|
|
|
|
|
kun_911 wrote:
...is possible to use Multiple Dialogs in an
MFC project?
Sure. You can have one, a dozen or a hundred. However many it takes to solve the problem.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
yes ...
you can use one modal at a time, or multiple modeless dialogs at a time.
Any links/tutorials will be helpful!
look around here at CodeProject, you might find something.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Anton Zarubin wrote:
How to get access to the letters in the outbox folder (Microsoft Outlook)
Like this (using Outlook automation):
_Application app;
_NameSpace ns;
COleVariant vtOptional((long) DISP_E_PARAMNOTFOUND, VT_ERROR),
vtTrue((short) TRUE);
MAPIFolder folderOutbox;
_Items itemsMessages;
if (app.CreateDispatch("Outlook.Application") == TRUE)
{
ns = app.GetNamespace("MAPI");
ns.Logon(vtOptional, vtOptional, vtTrue, vtTrue);
folderOutbox = ns.GetDefaultFolder(4);
itemsMessages = folderOutbox.GetItems();
...
}
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I had some c (not c++) files which I put into a win32 dll project and compiled. The h file looks like:
KLEINRAYC_API int
RAY_KLEIN_CC
(params_t * params);
and the .c file has the same thing in it:
KLEINRAYC_API int
RAY_KLEIN_CC
(params_t * params)
{
}
I compiled this and used the resulting .lib and .dll files in another project (where I did #include for the .h file and linked to the .lib file in project settings). However the linker says:
error LNK2001: unresolved external symbol "__declspec(dllimport) int __cdecl RAY_KLEIN_CC(struct CAD_CAC_params *)" (__imp_?RAY_KLEIN_CC@@YAHPAUCAD_CAC_params@@@Z)
Now I had done the exact same thing with another dll except the files in that one were .cpp (not c) and that doesnt cause any problems.
What do I need to do with this .c dll to make the linker happy?
Thanks,
sb
|
|
|
|
|
The solution is to change files in the project you're using the DLL in.
Try using extern "C" keyword in all declarations in the DLL header file of the new project. This marks all functions and variables inside the DLL to use C-linkage. The default is to use C++-linkage, and it will cause problems with C DLL's, like you've seen.
Does it compile properly now ? Any new errors ?
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
That was exactly the solution!!! I was worried I would have to go the loadlibrary route. Many thanks,
sb
|
|
|
|
|
How can develop the multiple clipboard using c++ (like Word...)?
Thanks
|
|
|
|
|
|
Hi,
I'm creating an MDI application in MFC but I need to display different views which correspond with some user setting. But I can't figure out how to display two different views in the same frame window. So I want to display either view A or view B, not both at the same time. Is this even possible?
|
|
|
|
|
Try using splitter windows
|
|
|
|
|
But won't the user be able to move the splitter back and forth?
What I exactly want is to have view A be visible with some combo menu selection, and view B being visible with another combo menu selection
|
|
|
|