Click here to Skip to main content
15,889,335 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to stop a .exe? ADDENDUM Pin
Richard MacCutchan21-Oct-09 2:21
mveRichard MacCutchan21-Oct-09 2:21 
Questiondll for project Pin
MA Awan20-Oct-09 18:54
MA Awan20-Oct-09 18:54 
AnswerRe: dll for project Pin
Cedric Moonen20-Oct-09 20:17
Cedric Moonen20-Oct-09 20:17 
GeneralRe: dll for project Pin
Richard MacCutchan21-Oct-09 0:20
mveRichard MacCutchan21-Oct-09 0:20 
AnswerRe: dll for project Pin
CPallini20-Oct-09 20:29
mveCPallini20-Oct-09 20:29 
AnswerRe: dll for project Pin
Rajesh R Subramanian20-Oct-09 20:32
professionalRajesh R Subramanian20-Oct-09 20:32 
QuestionException: This may be due to a corruption of the heap, which indicates a bug in WBEventsSheetCalculate.exe or any of the DLLs it has loaded. Pin
NarVish20-Oct-09 18:40
NarVish20-Oct-09 18:40 
QuestionRe: Exception: This may be due to a corruption of the heap, which indicates a bug in WBEventsSheetCalculate.exe or any of the DLLs it has loaded. Pin
Roger Stoltz21-Oct-09 2:53
Roger Stoltz21-Oct-09 2:53 
You really need to format your code using the <pre></pre> tags. Clicking 'code block' above the edit box when posting will do just that with selected text.
Have a look before you're posting code in order to verify that it looks as it should. You have used the std::vector template, but the template arguments are lost since they have been interpreted as HTML tags so the rest of us cannot figure out whether the map contains ExcelBookEventHandler objects or references to such objects.


North 2009 wrote:
void _stdcall WorkbookOpen(Excel::_Workbook *book)
{
    ExcelBookEventHandler calc;
    bookHandler.push_back(calc);
    int val = xl->Workbooks->Count;
    bookHandler[val-1].DispEventAdvise(book);
    cout<<"Inside Workbook Open";
}// here, I'm getting the exception</blockquote>


You've got to think this through....
You're creating an ExcelBookEventHandler object on the stack and adding it to the map; now it's really interesting whether the map holds real objects or references. The local ExcelBookEventHandler object will be destroyed when execution returns from WorkbookOpen().
What does the call stack look like when you get the exception?


North 2009 wrote:
CoInitializeEx(0, COINIT_MULTITHREADED);


Why?
Are you really using multiple threads from a COM perspective? I would guess that you're not since nothing in the code you've posted suggests that you are.
What happens if you change this to using an ordinary STA instead, e.g.
::CoInitialize( NULL );
or
::CoInitializeEx( NULL, COINIT_APARTMENTTHREADED );
?


"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown


QuestionNeed help for CStdioFile/CFile [modified] Pin
Nicholas Amh20-Oct-09 17:35
Nicholas Amh20-Oct-09 17:35 
AnswerRe: Need help for CStdioFile/CFile Pin
Naveen20-Oct-09 17:55
Naveen20-Oct-09 17:55 
GeneralRe: Need help for CStdioFile/CFile Pin
Nicholas Amh20-Oct-09 19:10
Nicholas Amh20-Oct-09 19:10 
QuestionRe: Need help for CStdioFile/CFile Pin
Randor 20-Oct-09 19:23
professional Randor 20-Oct-09 19:23 
AnswerRe: Need help for CStdioFile/CFile Pin
Nicholas Amh20-Oct-09 19:44
Nicholas Amh20-Oct-09 19:44 
GeneralRe: Need help for CStdioFile/CFile Pin
Randor 20-Oct-09 21:08
professional Randor 20-Oct-09 21:08 
AnswerRe: Need help for CStdioFile/CFile Pin
Adam Roderick J20-Oct-09 20:23
Adam Roderick J20-Oct-09 20:23 
GeneralRe: Need help for CStdioFile/CFile Pin
Nicholas Amh20-Oct-09 20:59
Nicholas Amh20-Oct-09 20:59 
GeneralRe: Need help for CStdioFile/CFile Pin
Richard MacCutchan21-Oct-09 2:33
mveRichard MacCutchan21-Oct-09 2:33 
QuestionWhen is a CWnd ready to receive messages Pin
ForNow20-Oct-09 16:14
ForNow20-Oct-09 16:14 
AnswerRe: When is a CWnd ready to receive messages Pin
Naveen20-Oct-09 18:12
Naveen20-Oct-09 18:12 
GeneralRe: When is a CWnd ready to receive messages Pin
ForNow20-Oct-09 18:19
ForNow20-Oct-09 18:19 
GeneralRe: When is a CWnd ready to receive messages Pin
Naveen20-Oct-09 18:29
Naveen20-Oct-09 18:29 
GeneralRe: When is a CWnd ready to receive messages Pin
ForNow20-Oct-09 18:39
ForNow20-Oct-09 18:39 
GeneralRe: When is a CWnd ready to receive messages Pin
Naveen20-Oct-09 18:43
Naveen20-Oct-09 18:43 
GeneralRe: When is a CWnd ready to receive messages Pin
ForNow20-Oct-09 18:54
ForNow20-Oct-09 18:54 
GeneralRe: When is a CWnd ready to receive messages Pin
Hans Dietrich20-Oct-09 21:59
mentorHans Dietrich20-Oct-09 21:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.