|
|
I have an ATL project where I define several ATL COM objects. I would like to be able to create instances of these objects inside my module without having to use CoCreateInstance(). Everytime I try to do so it claims the classes are abstract because they do not define QueryInterface,AddRef...
Is there a way to create these objects internally without having to call CoCreateInstance?
Here's the logic to why I want to do this. I'm using a local class to catch some COM events. The local class implements a COM interface but itself is not a COM object. If I create this class with CoCreateInstance I will only be able to get the Event Sink interface back. The only way that I know of to call methods on this object would be to create a new interface for the object for the local methods I need. I would really like to avoid this. Here is a sample bit of code to show better what I'm trying to do
<br />
CEventSink : public _IEvents<br />
{<br />
public:<br />
void Setup(IEventSource *source);<br />
}<br />
<br />
...<br />
CEventSink sink;<br />
IEventSource *source;<br />
... CoCreatInstance for source...<br />
sink.Setup(source);<br />
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
|
|
I'm getting this error in ATL 7.0 trying to capture COM events from another library. I've researched this error on the web and it says to make sure you've included several header files. I've included all of hte header files
(atlbase,atlcom) and I've defined ATL_ATTRIBUTES above them. So far I've had no success in removing the error. Any ideas?
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
I fixed this problem in a hackish way. I created a new ATL project and copied all of the code over to the new project and it compiled fine.
The original project did not include ATL by default. I added it to the project settings later. The events suggest to me that in some way I failed to add ATL support properly. So what is the proper way to add ATL support to a project that formerly did not have it?
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
|
Array operations, like multiplying two arrays, is common in my work, and I therefore wrote a float array class, inheriting from STL-class vector. This approach slowed down the array multiplication with a factor of 150,(instantly back to the days of a 20 MHz computer, wiping out 20 years development!), if I compared it to multiplying two arrays created on the stack. Not using the vector template class, but still using a float array and functions defined inside a class, slows down multiplication with a factor of 15. What is the reason?
Bill
|
|
|
|
|
Probably the generation of extra copies of your matrix. Look in the net, there are a lot of implementations floating around. Also, I seem to remember an article in a fairly recent c++ users journal [^]
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Hi,
I want to show line numbers on the left side of edit view. How to do that?
Thanks,
Derick.
|
|
|
|
|
Hi,
I'm witting an Outlook plugin in VC++, using ATL.
When a button in outlook is pressed, my plug-in will create a new mail, or reply to the selected one, or forward it. Now, the problem is that after generating this new window(for new mail, reply or fwd), when I close Outlook, another instance of Outlook remains somewhere running (I see it in Task Manager, and I have to close it form there). Any ideea what do wrong? Here is part of my code from the reply command:
for(int i=1; i<=lItemCount; i++)
{
CComPtr<IDispatch> spDisp;
CComVariant vt(i); //get selected item number i
hr = spSelection->Item(vt, &spDisp);
if(FAILED(hr))
return;
CComQIPtr< Outlook::_MailItem > spMailItem(spDisp);
CComPtr<Outlook::_MailItem> spMailItem2;
if(FAILED(hr))
return;
if(spMailItem!=NULL)
{
spMailItem->Reply(&spMailItem2);
BSTR subj;
spMailItem->get_Subject(&subj);
CString str = "Re:";
str += W2T(subj);
spMailItem2->put_Subject(T2W(str));
BSTR htmlBody;
spMailItem->get_HTMLBody(&htmlBody);
str = ReadHTMLIntoString((CString)W2T(bstrMSname)); //insert the Reply .html
str += "<br><br><br><i>Original text:</i><br><br>"; //something between our text and the original text
str += W2T(htmlBody);
htmlBody = T2W(str);
spMailItem2->put_HTMLBody(htmlBody);
spMailItem2->Display();
}
spMailItem2.Detach();
spMailItem.Detach();
spDisp.Detach();
}
I think something should be done with spMailItem2, but I just don't know what.
I would really appreciate any help.
Thanks,
Doru K
|
|
|
|
|
Hi there,
I am implementing connection points and i would like to know one thing here that is it possible to do custom marshalling with connection points.
My outgoing interface is something like this,
interface _INBDatabaseHandlerEvents
{
[helpstring("method RecieveBackupInfo")] HRESULT RecieveBackupInfo([in] BackUpInfo* bakupinfo);
}
where backupinfo is my own defined structue using multiple data types and they may not be automation compliant.
i have manually edited the coclass to
[default, source] interface _INBDatabaseHandlerEvents;
dispinterface removed and my object derives from IUnknown now.
QUESTION:
At the client side what should i do include .tlb or .h and .c for interfaces uuid.
And if provide only typelib information would it work if i have registered the proxy stub as well.
And i am just using the typelib to help the coz of not using .c and .h files from server
QUESTION:
how can i include .c file in different cpp for using cocreateinstance. It is not possible but i need the uuids for instantiating the objects.
Should i use typelib for custom interfaces with custom defined parameters it would make a difference or not.
Thanks in advance.
I'm looking forward for an urgent reply.
|
|
|
|
|
|
I'm following the MSDN ATL polygon tutorial. Anyways the control I want to port is nothing like the polygon control, but it'll due as a starting point. Basically I want to know if there is a way I can pass a large amount of data to the control?
Preferably I would like to pass text to the control using this method if possible.
<OBJECT>
Text from database would go here
</OBJECT>
If not, then even if I could pass large amounts text to the control via a PARAM tag inside the OBJECT???
Or am I going to have to use a JSCript method like AddText('Blah blah...')
Thans in advance
I'm drinking triples, seeing double and acting single
|
|
|
|
|
When i draw a contextmenu on my window, i dont receive any WM_COMMAND's when i click a menu option. Where should they go?
Thanks!
|
|
|
|
|
|
Hi All,
I'm trying to create a treeview using WTL which allows Drag'n'Drop but CreateDragImage & TreeView_CreateDragImage always return 0. Everything is okay up to the point where I try and create the DragImage. I'm I doing it in the right way or is there another way to do this. Please advice.
Thanks
Jens
Here is some sample code:
class CMyTreeViev : public CWindowImpl<cmytreeviev, ctreeviewctrlex="">,
public CCustomDraw<cmytreeviev>
{
public:
DECLARE_WND_SUPERCLASS(NULL, CTreeViewCtrlEx::GetWndClassName())
BOOL PreTranslateMessage(MSG* pMsg);
BEGIN_MSG_MAP_EX(CMyTreeViev)
REFLECTED_NOTIFY_CODE_HANDLER_EX(TVN_BEGINDRAG, OnBeginDrag)
CHAIN_MSG_MAP_ALT(CCustomDraw<cmytreeviev>, 1)
DEFAULT_REFLECTION_HANDLER()
END_MSG_MAP()
LRESULT OnBeginDrag ( NMHDR* phdr )
{
_ASSERT(0);
NM_TREEVIEW* pNMTV = reinterpret_cast<nm_treeview*> (phdr);
// CreateDragImage always return 0
CImageList im = CreateDragImage( pNMTV->itemNew.hItem );
// im = TreeView_CreateDragImage(m_hWnd, pNMTV->itemNew.hItem );
return 0;
}
};
|
|
|
|
|
From MSDN:Remarks
If you create a tree-view control without an associated image list, you cannot use the TVM_CREATEDRAGIMAGE message to create the image to display during a drag operation. You must implement your own method of creating a drag cursor. Does your tree have an image list?
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
CP SearchBar v2.0.2 released
|
|
|
|
|
|
I just finished the functor article here, and tried sth for rendering particles using functors. all seems to work fine, but I just wanted to make sure I didn't make sth stupid/ugly. here is the code;
<br />
template <class TParticle><br />
class ParticleRenderer<br />
{<br />
public: <br />
virtual void render(const std::vector<TParticle>& particles) = 0;<br />
};<br />
this is the base class, and I wonder, having a hierarchy of functors is a good idea or not (performancewise especially)
<br />
template <class TParticle><br />
class DefaultRenderer : public ParticleRenderer<TParticle><br />
{<br />
public: <br />
void render(const std::vector<TParticle>& particles)<br />
{<br />
std::for_each(particles.begin(), particles.end(), *this);<br />
}<br />
void operator ()(const TParticle& p) const<br />
{<br />
}<br />
};<br />
inside the operator() I do the rendering on each TParticle instance.
and here is how my Particles are stored..
<br />
template <size_t size, class TParticle><br />
class ParticleSystem<br />
{<br />
ParticleRenderer<TParticle>* m_pRenderer;<br />
std::vector<TParticle> m_particles;<br />
void render(){<br />
m_pRenderer->render(m_particles);<br />
}<br />
}<br />
so I can set different kinds of renderers (depending on client hardware), I don't need to check which renderer to use in everytime I call ParticleSystem::render. But this also means that some auxilary functions and member vars will be added to each derived renderer classes..
I would like to have some feedback, before implementing all.. thanks in advance.
|
|
|
|
|
Hi!
I'm writting an Outlook plugin, and a very nasty problem arised: I'm using some dialogs in my app, and one of them has to display a .html page. I've put a CWebBrowser ActiveX on it, but the dialog won't show up. The DoModal function returns -1 (couldn't create dialog). If I remove the activeX from my dialog everything works just fine.
Well, have you any ideea why this problem appears, or some workaround to display my .html page?
Thanks,
Doru K.
|
|
|
|
|
Use Mozilla instead
http://codeguru.earthweb.com/controls/iemozilla.html
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
Thanks, but that wasn't very usefull. I think the problem lies somewhere else...
Thanks anyway!
|
|
|
|
|
|
hi,
i have an application which consist of activex control and it is running, how can i use GetActiveObject function to get the iunknown pointer for that activex control.actually i want to excute the method of that activex control.
abhay
|
|
|
|