|
I'm making a Toolbar, or atleast, trying but I don't know how these things work, but mostly I created my COM object with ATL Simple Object and started to Implement Interfaces but then I started to add IDeskband, IInputObject, etc.. but it gives me an error:
c:\Program Files\Microsoft Visual Studio .NET\Vc7\atlmfc\include\atlcom.h(1756): error C2259: 'ATL::CComObject<base />' : cannot instantiate abstract class with
[
Base=CBandObj
]
class ATL_NO_VTABLE CBandObj :
public IObjectWithSiteImpl<cbandobj>,
public IDispatchImpl<ibandobj, &__uuidof(ibandobj)="">
Why does it give this error.. and if you can explain how to use the resource toolbar from the resources I'd really appreaciate it.
Alot of helps I find are all for VC 6.0 and add these Interfaces just like that, so I guess that is the problem.They're older versions.I would like to use only ATL programming to program the toolbar etc.. no WTL. Thanks
Oscar Ferreira
oscarferreira1@portugalmail.pt
|
|
|
|
|
there is a popular example of atlopengl_demo that can be downloaded in the page http://www.codeproject.com/atl/atlopengl.asp.
It is a opengl control created in VC, but when I use it in vb ,it can not work, why?
If I want to use it well in VB,how can I do?
thank you very much!
GOOD LUCK
|
|
|
|
|
What are the symptoms?
--
Schni Schna Schnappi! Schnappi Schnappi Schnapp!
|
|
|
|
|
what's the difference between:
int func(classA & test)
and
int funct(classA * test)
with differences i don't mean, the first is by reference and the second one is a pointer.
But what i want to know is, what are the advantages / disadvantages of those 2 ways of working to each other? And when should i use the first way, and when the second way?
why am i asking this? because sometimes i'm programming i don't know for which one to chose, because they both work for me.
thx
|
|
|
|
|
First difference, this is the wrong forum for this post! But, since people make honest mistakes...
Behind the scenes, there is no difference, at least not in VC++ 6.0. How references are implemented by a compiler is completely up to the compiler, but VC++ uses pointers. For example, if you create a function in a DLL that takes a reference, and you call it from a C program and pass in a pointer, it will still work correctly (at least, using the same builds of VC++ 6.0).
As far as usage, references are only available in C++ , not in C . Pointers have to be manually dereferenced in order to modify the item that it points to. References do this automatically, so the syntax of using them is different. For example:
int FuncA( int &iTest )
{
iTest = 10;
*iTest = 10;
return;
}
int FuncB( int *piTest )
{
*piTest = 10;
piTest = 10;
return;
} Think of a reference as an "atomatically-dereferencing" pointer. Barring IntelliSense or a similar coding aid, when you use references, it becomes easy for someone else to call the function not realizing that their variable may be modified by the function. When using pointers, they have to take the extra step to pass in the address of the variable, so they have an idea of what is going to happen (assuming non-const here).
Additionally, you can pass in a NULL pointer to a function, to indicate "nothing", but a reference has to refer to a real instance of something. For example, you can have an int pointer with a value of NULL , which means a pointer to nothing/nowhere, but you cannot have a reference that refers to nothing (barring some sneaking coding tricks).
References also have to be initialized, pointers do not:
<CODE>int iValue;
int *piValue;
int &riValue; There are a lot more details available on pointers and references beyond what I have written here...
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
thx for this info
sorry about the wrong forum, but didn't know where to post it, i didn't find a c++ forum.
|
|
|
|
|
The Visual C++ forum is the place for C++ related stuff.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
hmm...
All the C++ boffins will tell you to use the reference version because it's "safer", and that's their justification for just about everything to do with the language Just remember that you can't reassign references and you can with pointers - this might nudge you towards the pointer version.
Unless you have a fairly strange function, there is no performance gain from using one in particular. If you want to emulate the powers-that-be and go in the direction the C++ standards commitee have not-so-subtlely been trying to push us in, use the reference version. Be aware of the possiblity of unseen anonymous objects being created when you pass by reference (if you do indeed have to create a temporary const object) - obviously this isn't possible with pointers and prevents this bit of bloat.
I go with references cos company's love to see them in your code. To be honest there's not much to gain from it, but try and stick to one in style. It also stops you having to stick &'s everywhere
|
|
|
|
|
[ATL, VC++ 6.0 SP6]
Hello to all. I am working on an ATL COM project that needs to interface with a 3rd party application. This application uses IDispatch interfaces with CP-based event interfaces that go along with them (shudder ).
I have the following problem. I have an object that uses two interfaces, and implements two more as well as the connection-point-based event interface. Problem is, I now need to add another event interface sink to the object. After adding it, I am unable to call DispEventAdvise because the compiler cannot resolve the ambiguity between Event interface and the other.
I have tried various means of qualifying the function call, including using the expanded form of one version of the IDispEventImpl -derived class, but I cannot get any of them to work. If anyone has any idea how to resolve this, I would love to hear about it.
The def of the object's class is as follows (some identifiers renamed):
class ATL_NO_VTABLE CxxxxMWare : <br />
public CComObjectRootEx< CComSingleThreadModel>,<br />
public CComCoClass< CxxxxMWare, &CLSID_xxxxMWare>,<br />
public IDispEventImpl< 1, CxxxxMWare, &DIID_EAxxxxxxxx, &LIBID_xxxxLib, 1, 0 >,<br />
public IDispatchImpl<IxxxxMWare, &IID_IxxxxMWare, &LIBID_xxxxMIDDLEWARELib>,<br />
public IDispatchImpl<IxxxxMiddleWare, &IID_IxxxxMiddleWare, &LIBID_xxxxSERVERLib>,<br />
public IDispatchImpl<IMxxxxxxxxAPICB, &IID_IxxxxxxxxAPICB, &LIBID_xxxxSERVERLib><br />
BEGIN_SINK_MAP(CxxxxMWare)<br />
SINK_ENTRY_EX(1, DIID_EAxxxxxxxx, 0x01, BxxxxSxxxx)<br />
SINK_ENTRY_EX(1, DIID_EAxxxxxxxx, 0x02, AxxxxSxxxx)<br />
SINK_ENTRY_EX(1, DIID_EAxxxxxxxx, 0x03, WxxxxCxxxx)<br />
SINK_ENTRY_EX(1, DIID_EAxxxxxxxx, 0x04, Dxxxx)<br />
SINK_ENTRY_EX(1, DIID_EAxxxxxxxx, 0x05, AxxxxCxxxx)<br />
SINK_ENTRY_EX(1, DIID_EAxxxxxxxx, 0x06, OxxxxAxxxx)<br />
SINK_ENTRY_EX(1, DIID_EAxxxxxxxx, 0x07, Mxxxx)<br />
SINK_ENTRY_EX(1, DIID_EAxxxxxxxx, 0x08, Cxxxx)<br />
SINK_ENTRY_EX(1, DIID_EAxxxxxxxx, 0x09, Dxxxx)<br />
<br />
END_SINK_MAP()<br />
The class/object, as written, works correctly. I need to receive events from the DIID_ECxxxxCxxxx interface, and when the commented lines are uncommented, calls to DispEventAdvise from within the class' code become ambigious - the compiler cannot resolve between they two IDispEventImpl classes.
Any thoughts? I would perfer not to have to create a separate class for this Event interface, but that is what I will do if I cannot resolve this within the next day or so...
AdvaThanksnce!
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Have you tried qualifying the DispEventAdvise call with the name of the base class whose events you're trying to advise - like this:
IDispEventImpl< 1, CxxxxMWare, &DIID_EAxxxxxxxx, &LIBID_xxxxLib, 1, 0 >::DispEventAdvise(blah blah blah);
I put a typedef in my class declarations to give the base class a nice name. For example:
typedef IDispEventImpl<1, xxxxBrowserView, &DIID_HTMLElementEvents2, &LIBID_MSHTML, 4, 0> HTMLElementEventsSink;
allows me to write
HTMLElementEventsSink::DispEventAdvise(blah blah blah);
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
[EDIT] Gah! Never mind... I had a little brain cramp; it is working correcly now. Thanks again for helping me find the problem! [/EDIT] Yes... "I have tried various means of qualifying the function call, including using the expanded form of one version of the IDispEventImpl-derived class, but I cannot get any of them to work."
At least I thought I did... Now it works? I must have been copying over the template dec incorrectly...!
Well, now that code works, but other stuff is failing to compile:
...\atl\include\atlcom.h(3698) : error C2243: 'static_cast' : conversion from
'class ATL::IDispEventSimpleImpl<1,class CxxxxMWare,&struct _GUID const DIID_EAxxxxxxxx> *const ' to
'class CxxxxMWare *' exists, but is inaccessible Oh, well... I will just put the second event handler into its own little class and use it. Thanks for the post, anyway.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Whoops - should have read your message properly
However - that error message looks like you're calling DispEventAdvise from a const method.
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Nah; I changed the template decl to a typedef for clarity/readability but forgot to specify it as public when I used it in the class decl.
Besides, without your post I would never have gone bac and tried again.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I have successfully created an addin for Word using the article provided by Amit Dey on Outlook 2000. There is one problem that i am facing.
How do I make my addin work with multiple instances of Word?? Currently the addin only works with one instance of Word.
Any help would be greatly appreciated.
|
|
|
|
|
hi!
I want to increase or decrease the width of my activex control written in
VC7.1 using ATL. I have done following in the InitNew method but no effect.
SIZEL sz = {129,211};
AtlPixelToHiMetric(&sz,&m_sizeExtent);
m_sizeNatural = m_sizeExtent;
Any ideas?
what if i dont want user to increase the height and width of my control?
Thanks in advance.
Ahmad Jalil Qarshi
|
|
|
|
|
I think that may be i have posted this question to a wrong forum. If someone knows the right place to post this question. Please help me.
Thanks.
Ahmad Jalil Qarshi
|
|
|
|
|
Hi,
does someone have a stdafx.h file for an MFC project with WTL support? I have followed the information in the articles here and elsewhere in the web I can find, but am having problems including atlctrlx.h, atlctrlw.h - there seems to be some confusion on the part of the compile with common names such as CClientDC, CWindowDC, even though I am using #define _WTL_NO_AUTOMATIC_NAMESPACE
as suggested.
|
|
|
|
|
|
Thanks Mike. I understand this.
I will make changes in the WTL source files for my projects correct?
|
|
|
|
|
|
to conditional Compilation in the .idl file, if yes how ?, I am facing tough time doing this!
Thanks
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
You can use any C++ preprocessor directives.
With best wishes,
Vita
|
|
|
|
|
Vi2 wrote:
You can use any C++ preprocessor directives.
Hi Mr. Vita,
Thanks For Reply, actually condtional compilation cannot be possible without preprocessor, actually i fail to explain my problem. when ever I use preprocessor to hide a Interface and corresponding .h and .cpp file , it's still compile that .cpp files and give me compiler errror. though i resolve that error by removing corresonding file from the project.
Is there any way to stop compilation of particular cpp file through Visual Studio 6.0!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
ThatsAlok wrote:
Is there any way to stop compilation of particular cpp file through Visual Studio 6.0!
You can use the different Active Configuration (Build -> Configurations...) to make the different targets. As well as we use the Debug and Release configurations.
With best wishes,
Vita
|
|
|
|
|
Hi
I have a graph control built using ATL3.0 and used this control in VC++ client application.This control is working fine in my windows XP sys,but siezed to work properly on win 98.The problems are
1) we are displaying 5 grid lines along both X and Y axes.but on win 98 only 2 grids are being displayed along Y axis.
2) when I try to load a saved file(graph) on win 98 the graph is exceeding the plot area.
Every thing seems to be working fine on win XP.Has there any thing to do with ATL.dll. Infact we have used the correct ANSI version of ATL.dll for both 98 and XP..
Can any one plzzzzzzz help me??????
ThnX in Advance.
Naveen.V
|
|
|
|
|