|
Vaclav_Sal wrote: Scary, talking about "major surgery" here.
he he he.. continue your good work
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi all,
I am developing a snippet for extraction of msg propeties, I am using
outlook 2003. Now my problem is the current mapi_utils does not
extract the PR_HTML body which I need to show the embedded files in
the body and the right format of the body as well.
What I exactly need is the HTML format of the .msg file.
The current mapi_utils are only applicable upto outlook 2000.
Please help me
Thank you,
Jj
the code:
HRESULT hResult;
WORD wKey = 0;
LARGE_INTEGER liZero = { 0 };
LPSTREAM pTNEFStream = NULL;
LPITNEF pTNEFObj = NULL;
MAPIINIT_0 MInit;
MInit.ulVersion = MAPI_INIT_VERSION;
MInit.ulFlags = 0;
hResult = MAPIInitialize(NULL);
if (hResult !=S_OK){
throw(HResultException("MapiInit ResolveMsg",0));
}
IMalloc *m_pMalloc;
hResult = CoGetMalloc(1, &m_pMalloc);
if (hResult !=S_OK){
throw(HResultException("CoMalloc ResolveMsg",0));
}
IStorage *pStorage = NULL;
LPMSGSESS pMsgSession = NULL;
LPMESSAGE pIMsg = NULL;
hResult = ::StgOpenStorageEx(_bstr_t(msgName.c_str()),STGM_READWRITE |STGM_TRANSACTED ,STGFMT_DOCFILE ,0,
NULL, NULL, IID_IStorage,(void**)&pStorage);
if (hResult !=S_OK){
throw(HResultException("stgStorage ResolveMsg",0));
}
if (pStorage==NULL)
throw(HResultException("stgStorageNull ResolveMsg",0));
hResult = ::OpenIMsgSession(m_pMalloc, 0, &pMsgSession);
if (hResult !=S_OK){
throw(HResultException("OpenImsgSession ResolveMsg",0));
}
hResult = ::OpenIMsgOnIStg(pMsgSession,MAPIAllocateBuffer,MAPIAllocateMore,MAPIFreeBuffer,m_pMalloc,0,
pStorage,0, 0, 0, &pIMsg);
if (hResult !=S_OK){
throw(HResultException("OpenIMsgOnIStg ResolveMsg",0));
}
hResult = WriteClassStg(pStorage, CLSID_MailMessage);
if (hResult !=S_OK){
throw(HResultException("WriteClassStg ResolveMsg",0));
}
HRESULT hrProperty;
LPSPropValue lpPropValue = NULL;
hrProperty = HrGetOneProp((LPMAPIPROP)pIMsg,PR_MESSAGE_CLASS ,&lpPropValue);
if (hrProperty != S_OK){
loopMsg(pIMsg,pStorage);
hResult = pIMsg->SaveChanges (KEEP_OPEN_READWRITE);
if (hResult !=S_OK){
throw(HResultException("pIMsg->SaveChanges ResolveMsg",hResult));
}
hResult = pStorage->Commit(STGC_DEFAULT);
if (hResult !=S_OK){
throw(HResultException("Commit of HTML failed in redmap::MailFile::decodeTnef", hResult));
}
}
hrProperty = HrGetOneProp((LPMAPIPROP)pIMsg, PR_BODY_HTML, &lpPropValue);
hrProperty = HrGetOneProp((LPMAPIPROP)pIMsg, PR_HTML, &lpPropValue);
CBase64* baseconvert = new CBase64;
if (hrProperty != S_OK)
{
hrProperty = HrGetOneProp((LPMAPIPROP)pIMsg, PR_BODY_HTML_B, &lpPropValue);
if (hrProperty == S_OK){
CString text;
text.GetBufferSetLength(lpPropValue[0].Value.bin.cb + 1);
text.SetString((LPCSTR)lpPropValue[0].Value.bin.lpb,lpPropValue[0].Value.bin.cb);
enum {BODY, MSG_ADDPROPS };
SPropValue lpPropValueArray2[MSG_ADDPROPS];
lpPropValueArray2[BODY].ulPropTag = PR_BODY_HTML;
lpPropValueArray2[BODY].Value.lpszA = (LPSTR)text.GetString();
hResult = pIMsg->SetProps(MSG_ADDPROPS, lpPropValueArray2,NULL);
if (hResult !=S_OK){
throw(HResultException("SetProps of HTML failed in redmap::MailFile::decodeTnef", hResult));
}
hResult = pIMsg->SaveChanges (KEEP_OPEN_READWRITE);
if (hResult !=S_OK){
throw(HResultException("SaveChanges of HTML failed in redmap::MailFile::decodeTnef", hResult));
}
hResult = pStorage->Commit(STGC_DEFAULT);
if (hResult !=S_OK){
throw(HResultException("Commit of HTML failed in redmap::MailFile::decodeTnef", hResult));
}
if (lpPropValue) MAPIFreeBuffer(lpPropValue);
}
}
pIMsg->Release();
pIMsg = NULL;
CloseIMsgSession ( pMsgSession );
pMsgSession = NULL;
pStorage->Release();
pStorage=NULL;
::MAPIUninitialize();
return 1;
|
|
|
|
|
LINK : fatal error LNK1561: entry point must be defined
Error executing cl.exe.
in Vc++ 6.0 when I try to build the project I am getting this error
Pls help me out in resolving this error
Thanks in advance,
Ashok Reddy.
-- modified at 21:43 Sunday 9th September, 2007
|
|
|
|
|
|
I wrote a program that calculates a multivariable linear regression. Everything works. He can calculates the parameters (4 times) and writes them in a text file.
The problem is that when he arrives at the end of the calculate function (onbtnClicked) there comes a popup with next message:
Unhandled exception at 0x006329c2 in RegressionTool.exe: 0xC0000005: Access violation reading location 0xfeeefee8.
Visual studio opens the file dbgheap.c and goes to line 1595.
When I remove some lines, especially the inverse line, he doesnt give the message anymore.
|
|
|
|
|
minike wrote: isual studio opens the file dbgheap.c and goes to line 1595.
If you look at the call stack, you should be able to work your way back to the
offending line in your code. Somewhere, a pointer is getting messed up.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Alright I found the place. It is in the destructor of my Matrix class. But it only happens wen inverting. I don't seem to be able to find why.
|
|
|
|
|
There are many things that can cause an access violation; saying “I’m getting an access violation, please help,” is like going to a doctor and simply saying, “I don’t feel well.” At a bare minimum you should provide the following:
- The callstack to the faulting code.
- The source code around the faulting code.
One clue I can see from your description is the address “0xfeeefee8”; it’s nearly 0xfeeefeee. See here[^] for details. It looks like you might have a dangling pointer!
Steve
|
|
|
|
|
Alright, don't laugh.
I usually use Visual C++ 6.0 for just about anything but my latest project is using Visual C++ 7.1 and I'm trying real dialogs (property pages) for the first time in this environment and I'll be darned if this collosal piece of %@&* does not set up my DDX_Text statements for my edit controls when I add a variable for both the value and the control, or even just the value without a control variable.
I'm using the "Add Variable" thingy when I right click on the control in the dialog editor and adding a variable for both the value and the control.
What am I doing wrong or do I need to hand code those as well?
// This is what I'm used to in Visual C++ 6.0
void CSomePropPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
DDX_Text(pDX, IDC_SOME_SYMBOL, m_nSomeInteger);
DDX_Control(pDX, IDC_SOME_SYMBOL, m_editSomeControl);
}
// This is what I'm getting in Visual C++ 7.1
void CSomePropPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
DDX_Control(pDX, IDC_SOME_SYMBOL, m_editSomeControl);
}
|
|
|
|
|
Well, I'm finding these DDX/DDV routines are still fairly weak. Numeric does not allow negative sign etc...
I think some custom routines are needed.
Any ideas or insight still welcome.
|
|
|
|
|
Where can I go to get an index for error numbers? I run this code and get 102 errors Many of them: error C2784
Salestaxrate = .10;
Discountrate = .10;
int pizzaCost, popCost, chickCost, discount, salestax, subtotal, dueAmt, totAmt;
totAmt = pizzaCost + popCost + chickCost;
discAmt = (pizzaCost + popCost) * discountrate;
subtotal = totAmt - discAmt;
taxAmt = subtotal * salestaxrate;
dueAmt = subtotal + taxAmt;
cout << "Please enter the customer name.\n" name;
cin >>name;
cout << "Enter the pizza cost.\n" pizzaCost;
cin >>pizzaCost;
cout << "Enter the pop cost.\n" popCost;
cin >>popCost;
cout << "Enter the chicken wing cost.\n" chickCost;
cin >>chickCost;
cout >> "Total for food".\n; totAmt;
cout >> " Less discount on pizza and pop.\n" discAmt;
cout >> " Plus tax .\n" taxAmt;
cout >> "Total Due.\n" dueAmt;
return 0;
}
|
|
|
|
|
|
you have some errors:
1) "Salestaxrate = .10;
Discountrate = .10;"
this variable have not type
2) in C++ values "Testvalue" and value "testvalue" are different;
3) operation '.' is't concatenate as it is in PHP
4) you must define value befor you use it
5) '\n' means beark line as ' ' in html and it is purt of the string
you cant write: "test string".\n you must write "test string\n"
6) use MSDN it will help you
P.S.
find good book for beginers
|
|
|
|
|
Where did you declare variables?(Salestaxrate ,Discountrate )?cout statements has problem and wheres main function?
|
|
|
|
|
shortstuff55 wrote: Where can I go to get an index for error numbers? I run this code and get 102 errors Many of them: error C2784
With VS6, you can hit F1 on the error (just like you would for a function) and it will open up in a help window.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
I'm currently attempting to develop a simple owner-draw menu, and I need to determine the current menu font in order to return the correct string length via the WM_MEASUREITEM handler (I'm not using MFC).
Does anyone know of a way to do this via the WIN32 API?
Thanks in advance, Lee.
|
|
|
|
|
Call SystemParametersInfo(SPI_GETNONCLIENTMETRICS) , the NONCLIENTMETRICS struct tells you the font used for menus.
|
|
|
|
|
im using CFileFind to search for certen file types (EG. .log .tmp .bak" the way i have it is after it finds a file it run another loop to check all the file types im looking for is there a better and fast way to check if the file found matches what im looing for? is there a way to put all the file types in a string and check it once for each file found instead of the loop? and im checking each file found against 2 other list a file exclue and path exclude list. as it is it takes about 6 mins to scan all of my harddrives.
|
|
|
|
|
Could you use "FindOneOf" in CString?
For example I am looking for a numeric value in my string using this:
CString subWeight = "0123456789";
int found = strText.FindOneOf(subWeight);
Vaclav
|
|
|
|
|
For each file found, call PathFindExtension() to get its extension. Then just compare that extension with those in your list (e.g., .log, .tmp, .bak).
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
its not just extensions im searching for for some ill find the whole thing like "readme.txt" for some i need to find just the first part like "readme" for the rest it will be the extension i have it where it breaks the word down from "readme.txt" to "readme" ".txt" and i check all 3 but it is very slow running the loop for every file found right now there is about 30 different things im searching for so for each file found the loop runs 30 times and there is 3 list so for each file and folder found the loop really runs about 40 times thats why i need a way to check all 30 at once.
|
|
|
|
|
locoone wrote: ...i need a way to check all 30 at once.
You can't get around this requirement. In other words, if you are looking for .log, .tmp, and .bak files, you will need to do three checks for each file found.
Does this help?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I understand how to set the modified flag in a CPropertyPage derived class and how it affects the ApplyNow button etc...
However, I would like to query that value if the CPropertySheet derived class returns IDOK to see if a refresh of the properties, client area, etc... is really necessary.
Does anyone know how to query the modified flag, directly or indirectly, that gets set in the CPropertyPage when calling CPropertyPage::SetModified() ?
|
|
|
|
|
I haven't seen any way to get the modified state of a property page.
If you override OnOK in the page class(es) you could set some flag.
OnOK should only be called for dirty pages, and only when the user doesn't cancel.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
That's probably what I'll do. I was quite surprised to see the message get sent in the CPropertyPage::SetModified source but I couldn't find where it was going or how to query it.
thanks again for helping.
|
|
|
|