|
post copy constructor of EMEventContainer
dynamic allocations inside EMEventContainer?
Kuphryn
|
|
|
|
|
This is usually a sign that you have some memory issues elsewhere in your code. Debug builds allocate extra space before and after sections of memory to help indicate if you have any buffer overrun issues. Release builds don't have that, so if you do have such a problem, you will corrupt memory rather quickly. Things to look for are the constructor of the EMEventContainer object, its copy constructor, its copy assignment operator, any heap allocations within that class, and if you are using multiple threads, any unprotected accesses to an STL container.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hello,
I have Visual C++ program that implements Graphical User Interface (GUI). This program uses CWinApp, CFormView, CFrameWnd, and CDocument.
Now I need to package this C++ application to work as COM DLL (or ActiveX).
This program must be used as popup window from another program written in Java.
Is it possible to convert Visual C++ program with GUI into COM DLL or ActiveX ?
Please advice.
|
|
|
|
|
I expect you'll have to create a new MFC ActiveX project and copy across and/or modify the existing code.
Kevin
|
|
|
|
|
My former employer wanted a similar thing done. After months of research, we found out that yes, we could reuse SOME of the existing code, but that we would still have to rewrite a lot of code to get it to behave as an ActiveX control. Basically, if your code is layered (e.g. a 3-layer setup where GUI is separate from business logic is seperate from data access) then you will likely only have to rewrite the GUI layer. If not, you will be doing it piece-meal.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hello,
Thank you for information!
I found an article called "Adding automation to MFC applications":
http://www.codeproject.com/com/mfc_autom.asp
This article outlines steps that should be taken to enable MFC application as COM object.
I am trying to follow these steps. But, I am running into number of problems. I am new to Visual C++ environment, and it takes me some time to resolve these issues.
The problem that I am trying to resolve now is with IDL file. I am able to compile IDL with MIDL. I included generated header file into my Visual C++ project. However, when I include generated C file, I am getting compile errors.
If at some point I will succeed with this project, I will share details of my work on this web site.
Thank you!
|
|
|
|
|
I have the following code:
std::vector<emeventcontainer>::iterator it=pevent.begin();
try{
while(it != pevent.end()) {
RepDataManager::Log(RepDataManager::HIDEBUG, " Processing next");
EMEventContainer curr = *it;
......
.....
.....
...
it++;
RepDataManager::Log(RepDataManager::HIDEBUG , " About to process next element");
}
This function succeeds in debug builds but results in abnormal crashes in release build .I am using VC++ .NET 7.0
How can i avoid this crash?I have read abotu checked iterators but do not know how to work around this crash.I have tried #define _SECURE_SCL 0 but to no avail.
|
|
|
|
|
rana74 wrote: EMEventContainer curr = *it;
By any chance , Should there any problem, in how curr is used.
Can you see, by commenting that usage, iteration though all elements is problem free?
|
|
|
|
|
I have read that we can use
#define _HAS_ITERATOR_DEBUGGING 0
#define _SECURE_SCL 0
to disable the checked-iterator behaviour in VC++ 5.0
However,instead of defining this at the top of each c++ file,is there some place in project settings where i can define this ,so that it applies to all c++ files?
|
|
|
|
|
1. Include your macros in a common header file and include this file in all your required files.
OR
2. Include your macros in stdafx.h
OR
3. If I am not wrong there is a compiler option "/D". Check this in MSDN.
S o h a i l K a d i w a l a
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Hi there.
I was coding a c++ dll using some tipical inheritance structure where classes classB and classC extended abstract classA.
From a MFC c++ dialog based application, everything works like a charm, but I need this stuff to be used from a VB applicaction.
So I started reading and reached that I should code COM objects, and more exactly, ATL.
First approach worked, and I'm able to call an object from the ATL dll in a VB test code.
However, problems are when I try to reproduce my inheritance structure within all these ATL interfaces mess.
This is the code i would like to run written in c++:
ClassA object = new ClassB();
As you can see, I declare object as ClassA, but I instantiate it as ClassB. I don't want classA to be able to be instantiated (abstract), but I can't declare an ATL interface over an abstract class, so, I won't be able to use it from VB. And I don't know how to deal with inheritance. Child classes don't seem to "see" parent public and protected methods when used in the VB test app.
I don't post any code cause I don't think it would help. If you know what am I talking about, I'm sure you'll be able to point me to the issue, maybe a good and clear article about all this stuff.
I've made some further reading, but with no success. At the point, not exactly stuck, but quite lost.
Any help would be greatly appreciated.
Thanks so much.
Palako
|
|
|
|
|
Is your abstract class (ClassA) a pure abstract class, as in all of the methods are virtual?
If so, you are describing a classic COM style interface.
To say that a class cannot derive from an abstract class is not correct. You can derive from it, but of course, you must implement the methods that it would provide. A common way of doing this using ATL (which uses 'upside-down' inheritance) is to define an intermediate templated class, typically ClassAImpl<> which takes a class as it's template parameter. The impl class can then use something like
T* pT = static_cast<t*>(this)
to get at the concrete class's instance when necessary.
For more details, read this[^] article by Jim Beveridge, which explains the evolution of the ATL design.
Steve S
Developer for hire
|
|
|
|
|
i want to block the e-mail attachment in internet explorer. whenever user attaches or trying to attach something with the mail it block the activity. i need the code to block the gmail attachment using VC++.
any one knows please reply thanks
|
|
|
|
|
This question is asked here[^] ,too.
|
|
|
|
|
Hi all.
I have a listview handle and some item index. I want to select it via windows api.
Can someone help me?
Thx in advance.
Best Regards,
Marco Alves.
|
|
|
|
|
Set the item state to include LVIS_SELECTED.
If it's a single select, you might need to unset that bit for the current item.
Steve S
Developer for hire
|
|
|
|
|
|
try SetCurSel(ItemNumber)
|
|
|
|
|
That is for a list box, not a list view control
|
|
|
|
|
I have a FrameWindow which has splitter controls, which in turn have Pane Controls, which in turn have Tab Controls. No on one of the Tab Controls, I have created some CEdit Controls. These CEdit controls have to be created dynamically as the number of Edit controls is decided at runtime. I create the edit controls and store them in a CSimpleArray.
This is what I do.
CEdit* cEditInput = new CEdit();<br />
cEditInput->Create(m_hWnd, CRect(0,0,0,0), "", WS_CHILD | WS_BORDER | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | ES_LEFT | ES_AUTOHSCROLL, 0 );
My problem is that, the edit control which gets created doesn't process any Backspace and Delete keys. Can anyone explain why?
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
<marquee behavior="alternate" scrollamount="5" scrolldelay="50">
|
|
|
|
|
Hakuna-Matada wrote: CRect(0,0,0,0),
Is this intentional? You mentioned 0 as last parameter of create , try giving it some unique id's.
Actually I'm not sure, But this is just wild try.
Make sure, these keys works in other application's edit boxes,too.
|
|
|
|
|
hi all,
CMAPIAdviseSink::OnNotify(...) will give the notification of email, Please let me know the steps to be followed to get the Notification of Messages when a Mail is Send to your computer.
Uday kiran
|
|
|
|
|
You have to implement a sink object (something that has the AdviseSink interface as well as IUnknown stuff, like QueryInterface) and then pass that as an advise sink to MAPI.
Your OnNotify() implementation will get called appropriately.
Steve S
Developer for hire
|
|
|
|
|
hi steve,
How do i create AdviseSink Object any help and suggestions and Procedures to follow.
please help me out.
Uday kiran
|
|
|
|
|
Hmm. You've obviously not done anything like this before.
A sink object is the term for an object that implements a specific interface.
Let's say your interface is IMySink.
Somewhere you have a definition for this.
In C++, you can say that a class of objects derives from a number of base classes, leaving aside the 'diamond' problem of multiple inheritance.
So you can say
class CMyClass : public Someclass, public IMySink
{
...
};
You provide implementation for each of the methods in IMySink, and any classes that it inherits from (such as IDispatch or IUnknown). Many of these can simply return S_OK, or even E_NOTIMPL, since you may not need them to actually do anything.
You then need to get the interface in your app, and connect it to the COM object that's providing the notifications.
Say you have
CMyClass myObj;
then
IMySink* pSink = static_cast<IMySink>( &myObj );
will do the first bit, and you then need to pass that interface to the other side. There will be an Advise( ) method or similar, for example, the IMAPISession interface implements this, and one of it's parameters is an advise sink pointer. That's you, that is...
When you're done, you will need to de-register by calling Unadvise() or whatever the equivalent is.
Now for the fun bit; when the MAPI session object wants to tell you that something has happened, it will call the appropriate function of your interface. If you are being a good COM citizen, you won't do much direct processing in the function, maybe copy some parameters and post yourself a message or something. Why? Because the MAPI object can't continue until your function returns, and you really don't want to hold things up unless you really have to...
Enjoy.
Steve S
Developer for hire
|
|
|
|
|