|
I have a clsid of a com component now i want to know its interface identifier. How can i do it.
Thanx in advance
Regards
INAM
Inam
|
|
|
|
|
A CLSID is a GUID that references a coclass; whereas an IID is a GUID that references an interface in the coclass. I'm not sure I understand what you're really wanting becuse a coclass can support more than one interface - which means there will be more than one IID. Are you sure you're not wanting the ProgID? if so you can use:
CLSIDFromProgID
or
ProgIDFromCLSID
Regards,
|
|
|
|
|
I created a user control using c#.it automatically saved as .cs file.it works
properly.what i want now is to use it in a web page.but i can't find it's class id.i tried regedit.i typed the path of the project & searched.but no use.can somebody help meee?????
madara
|
|
|
|
|
I've found an excellent article by Dino Esposito on the MSDN about Browser Helper Objects, which is what I'm trying to write. However, I can't find the example source code (ViewSource) that allegedly goes with it, anywhere. Before you say it, I've posted messages on the MSDN board, but I thought I'd try here too in case anyone has it or can tell me where to find it.
Dave
|
|
|
|
|
|
Luca
yes, that is the article 'Browser Helper Objects: The Browser the Way You Want It', that I found on the web, but although the article refers to source code I couldn't find the code. If you have found the article AND the code, can you tell me how to get the code. Thanks.
Dave
|
|
|
|
|
hi
i used ie head files to make dximagetransform. And i included related head files. but the compile errors appeared:
e:\internet explorer 6sp1 header and library files\include\dxatlpb.h(298) : error C2668: 'InlineIsEqualGUID' : ambiguous call to overloaded function
e:\internet explorer 6sp1 header and library files\include\dxatlpb.h(308) : error C2668: 'InlineIsEqualGUID' : ambiguous call to overloaded function
e:\internet explorer 6sp1 header and library files\include\dxatlpb.h(313) : error C2668: 'InlineIsEqualGUID' : ambiguous call to overloaded function
what's wrong?
thanks.
|
|
|
|
|
Are you using ATL as well? Try this (ugly, but maybe useful) hack:
using ATL::InlineIsEqualGUID;
#include <dxatlpb.h>
--
Gott weiß ich will kein Engel sein.
|
|
|
|
|
I have been running around in circles trying to find comprehensive guidelines and examples on how to write "both" components, the msdn site is totally#$#$# up.
Can someone give me some guidelines and point me to some articels/samples?
thanks a heap
Man Learns from History that he never learns from History
|
|
|
|
|
Could you be a little more descriptive in what you mean by "both" components.
- Nick Parker My Blog
|
|
|
|
|
Trying to write an in-process component whose threading model will be "both". I want it to be instantiated in the same apartment as the client, irrespective of whether the client has entered an STA or MTA. If I understand right, the main criteria for writing this kind of component pertains to how I can perform callbacks to the client.
thanks
Man Learns from History that he never learns from History
|
|
|
|
|
That's right. If your component might use the client object on the thread other than STA (if the client is in STA), you'd have to do marshalling/unmarshalling of the client object "manually".
Edward
|
|
|
|
|
So would this work? When I decide I need to do a callback, I check the thread id of the current thread. If it matches the one that passed the callback pointer(which I would have stored somewhere), I make a direct call. If not, I call it via a proxy which I implement with custom marshalling.
BTW, if I dont use callbacks in the component, can I go ahead and implement it as "both" without worrying about anything else?
thanks!!
Man Learns from History that he never learns from History
|
|
|
|
|
I wouldn't bother with checking threadid, you rcomponent might be called from MTA.
If your object pointer is not being passed directly to another thread (for instance one of object's methods created thread and from this thread you invoke one of the objects methods) you do not have to worry about this at all.
And you are right, if you do not use other objects (callbacks or internally created com objects) in your component you don't have to worry about all this (of course synchronization must be taken care of).
As for marshalling, in case it's necessary, I usually prefer using GIT (global interface table, works on NT sp3, Win95 with dcom): for instance when object gets created I'd register it in the GIT (IGlobalInterfaceTable::RegisterInterfaceInGlobal) and then all other threads that need to use the object would get the interface pointer from GIT (GetInterfaceFromGlobal) instead of using it directly, this way none the object itself can use any internal com objects (callbacks) safely.
HTH,
Edward
|
|
|
|
|
So we do not need "custom" marshalling here, only "manual" invocation of the facilities already available. When the component gets the interface pointer to the callback object, it checks it into the GIT. When the client needs to be notified of something, the interface pointer is checked out from the GIT and the callback performed.
thanks
Steve
|
|
|
|
|
I am converting COM stuff to C#, but i'm not entirely sure about IEnumIDList.Next, or what exactly it returns.
HRESULT Next( ULONG celt,
LPITEMIDLIST *rgelt,
ULONG *pceltFetched
);
Now, celt is supposed to be the size of the LPITEMIDLIST right? So this enables people to look up multiple items in one go?
The pCeltFetched is a value that indicates how many items are actualy returned of the ones you desire?
Am I right here?
I've written some code that uses this interface and appears to work fine (Note, I get the IEnumIDList via the SHGetDesktopFolder, and the methods call ok when the result is cast). But No matter how big I make Celt, i always get back 17 (I have 12 non Shortcut Items, 7 shortcut items and recycle bin on my desktop) different <rgelt> values before it begins returning null pointers (No S_False value is returned, always returns 0). Also, the pCeltFetched is always 1, until the 7th value is reached, and then it is 0.
I can't determine what is being returned in the array as I haven't casted rGelt.
This is an array of ITEMIDLIST's? Or a pointer to ITEMIDLIST that is an array?
Could someone explain this method to me, as it's mildly confusing - being new to COM and all.
Cheers
Cata
NOTE: Not sure if this is any help, but here is the sample of code that I am using to call the function. It has no purpose, i'm just experimenting, but it might show what's wrong:
<br />
ArrayList MyIntPtrArray = new ArrayList();<br />
int myInt = 0;<br />
IntPtr item = new IntPtr();<br />
int result;<br />
<br />
do<br />
{<br />
result = IDList.Next(10, ref item, out myInt);<br />
if (item.ToInt32() != IntPtr.Zero.ToInt32())<br />
{<br />
MyIntPtrArray.Add(item);<br />
}<br />
<br />
}while(item.ToInt32() != IntPtr.Zero.ToInt32());<br />
<br />
Where result is always 0. myInt is 1 until the method retuns null pointers. Item is new for every iteration up to 17 (that's the arraylist count when the program finishes).
|
|
|
|
|
The Catalyst wrote:
Am I right here?
Yes you are. For reference, see IEnumXXX in the MSDN docs.
The Catalyst wrote:
This is an array of ITEMIDLIST's? Or a pointer to ITEMIDLIST that is an array?
It's an array of LPITEMIDLIST which is an array of pointers to ITEMIDLISTs.
Now, I'm no C#/COM guru, but I think your sample code is wrong. It should probably be something like this:
IntPtr arr[] = new IntPtr[10];
int num;
do {
IDList.Next(10, out arr, out num);
for(int i = 0; i < num; ++i) {
doSomething(arr[i]);
}
} while(num == 10);
--
Gott weiß ich will kein Engel sein.
|
|
|
|
|
Hi all,
I am new in ATL COM, I have created a Simple Object using ATL Object wizard,
and one simple Method.
The appwizard generated something like this
<br />
class ATL_NO_VTABLE CSimpleObject :
public CComObjectRootEx<CComSingleThreadModel>,<br />
public CComCoClass<CSimpleObject, &CLSID_SimpleObject>,<br />
public IDispatchImpl<ISimpleObject, &IID_ISimpleObject, &LIBID_FIRSTLib><br />
{<br />
}<br />
Now i am trying to use this component in client(mfc app), for that i have imported the header file of the component(simpleobject.h) in my mfc app.
When i try to compile my mfc app.
Its gives me
error C2079: 'CSimpleObject' uses undefined class 'ATL_NO_VTABLE
Can anybody tell what is error in ATL world??
Thanks in advance,
Abhi Lahare
|
|
|
|
|
It's a macro which expands to __declspec(novtable) for Visual C++. This is a hint to the compiler not to set the virtual function table pointer in the constructor. From the documentation:
"This form of __declspec can be applied to any class declaration, but should only be applied to pure interface classes, that is, classes that will never be instantiated on their own. The __declspec stops the compiler from generating code to initialize the vfptr in the constructor(s) and destructor of the class. In many cases, this removes the only references to the vtable that are associated with the class and, thus, the linker will remove it. Using this form of __declspec can result in a significant reduction in code size.
"If you attempt to instantiate a class marked with novtable and then access a class member, you will receive an access violation (AV)."
You don't normally use an ATL object derived from CComObjectRootEx directly; instead, the ATL class factory generates a CComObject<CSimpleObject> when it's asked to by COM. Eliminating the vtable can save on both code size (through not setting the vfptr) and on data size (through omitting CSimpleObject's vtable).
If you don't want to use CSimpleObject as a COM object, remove ATL_NO_VTABLE, all of the CComXxx base classes, and IDispatchImpl .
If instead you want to use the COM object from your MFC application (leaving the object implementation in the DLL), use ClassWizard or a #import statement to reference the type library. You could also use the interface headers generated from the IDL file that describes the object's interfaces. Use CoCreateInstance to create the object.
|
|
|
|
|
Hi Mike,
I want to do
MiKe:
If instead you want to use the COM object from your MFC application leaving the object implementation in the DLL), use ClassWizard or a #import statement to reference the type library. You could also use the interface headers generated from the IDL file that describes the object's interfaces. Use CoCreateInstance to create the object
but how??. (i.e how my client (mfc app) will know the defination of "CSimpleObject")
Again Thanks in Advance.,
Abhi Lahare
|
|
|
|
|
Actually i am developing a class in which it will take any com object and will be able to set and get the properties. Now i have taken the clsid of the component. Now how can i get its properties as GetIdsofNames function of IDispatch takes names. Please Guide me briefly with a little example or tell me some article
Thanx in advance
Regards
minamkhan
Inam
|
|
|
|
|
GetIDsOfNames accepts property names too, but I think you want to know the names of supported properties instead. You need to read the object's type information.
You can ask an object if it can provide type information by calling the GetTypeInfo method of IDispatch . You can then find out how many properties it has by calling ITypeInfo::GetTypeAttr . You can get information on the properties with ITypeInfo::GetVarDesc .
|
|
|
|
|
Sir Actually i have only the progId of the component now i want to also know how i will get the interfaces in this component dynamically than how can i get the names and return types of the properties in the interface dynamically. so that i will be able to get and set the properties in that interface. Sir please explain me little briefly as i am new to this topic. or if possible gave me a little example too.
Thanx in advance
Regards
minamkhan
Inam
|
|
|
|
|
Does anyone know of a "commercial" ActiveX control that utilizes a CListCtrl/CListView?
Charlie Roderick
|
|
|
|
|
Hmm.. what do you mean with utilizes? Are you looking for an activex control which behaves just like CListCtrl, or are you just curious whether anyone have been "bold enough" to use CListCtrl commercially?
--
Gott weiß ich will kein Engel sein.
|
|
|
|