|
Look at the subkeys of "HKEY_CLASSES_ROOT/CLSID" in the registry.
Steve
|
|
|
|
|
Hey good luck,
i have created the sample application for same
see the following code
CoInitialize (NULL);
ICatInformation *pCatInfo=NULL;
HRESULT hr=CoCreateInstance (CLSID_StdComponentCategoriesMgr ,NULL,CLSCTX_INPROC_SERVER,IID_ICatInformation ,(void **)&pCatInfo);
pCatInfo->AddRef ();
IEnumGUID *pEnumGUID=NULL;
CATID pcatidImpl[1];
CATID pcatidReqd[1];
pcatidImpl[0]=CATID_Control;
pCatInfo->EnumClassesOfCategories (1,pcatidImpl,0,pcatidReqd ,&pEnumGUID);
CLSID clsid;
while( (hr= pEnumGUID->Next( 1, &clsid, NULL ))==S_OK )
{
BSTR bstrClassName;
OleRegGetUserType (clsid,USERCLASSTYPE_FULL,&bstrClassName);
CString strControlName(bstrClassName);
m_list1.AddString (strControlName);
}
pCatInfo->Release ();
CoUninitialize ();
Knock out 'T' from CAN'T
You 'CAN' if you think you 'CAN'
|
|
|
|
|
Can someone explain me the major differences between an ActiveX control
and a COM dll in the context of accessing it from a web page using some
script.
For example, I need to get the MAC ID of the machine from within a web
page. So I thought of developing a COM dll, pack it in a cab using
cabarc, and call the method from within a script in the OnLoad of the
page. Do I need to actually go for creating an ActiveX control instead
of developing the COM dll? Is there any problem with using a COM dll?
Is there any additional advantage in going for ActiveX instead of COM
dll? Infact both the approaches worked fine on my development machine
!!
Thanks in advance.
|
|
|
|
|
If you dont need any UI features, then ofcourse you can go for a simple com component. Activex is for putting UI stuff.
rgds..mil10
|
|
|
|
|
How many kinds of DLLs are there? one that we are able to use with VB, ASP ect. The one which we are able to use with C++ but not VB, Can we create a DLL that is not COM based, and use it in VB? And what kind of Dlls we find in the windows system directories? Can any one brief on it?
NULL
|
|
|
|
|
For more information on dll's you can refer the bottom link
http://www.thevbzone.com/l_dll.htm#DLL%20TYPES
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
Hi,
In one of the code snippets i have seen this.
It looks something like this.
interface IA;
interface IB;
class CCOMTest : public IA,public IB
{//Some code here
}
Inorder to get the pointer to IA,
the code looks something like this
static_cast<IA*>this;
why static_cast ??
what happens if i do (IA*)this ???
can anybody clarify my doubt??
I am a beginner to COM.
Thanks in Advance.
Appu
|
|
|
|
|
this is available in this codeproject site itself.
visit : http://www.codeproject.com/cpp/static_cast.asp
^-^
@|@
- redCat
|
|
|
|
|
"Normal casting" (a.k.a "C-style" casts) should be avoided. If you need to cast always use static_cast , const_cast , reinterpret_cast or dynamic_cast . There are many reasons, some of which are that with these "function-style" casts your cast is:
1. Explicit (in intent).
2. Visible.
3. Checked for safety by the compiler.
There are still many people who use C++ but, for one reason or another, use "C-style" casts: These people are making a mistake. If you've been a maintenance programmer for a few years and seen the havoc caused by vague (in intent) and hard to spot or grep for casts you will probably agree. Some people argue that the new casts are ugly. That is intentional: casting, in general, is an ugly and dangerous practice and more often then not indicates a design flaw in your code. Casts should be ugly.
Steve
|
|
|
|
|
Hi All,
Can anybody explain the need of default interface in COM?
I am beginner to COM.
Thanks in Advance.
Appu
|
|
|
|
|
hi ,
i guess you are asking about IUnknown.
if so, this interface contains the 3 basic methods that are pillars of COM technology to work.
Interface is nothing but the abstract base class in c++.
it means that ultimately all components are required to implement these three methods and simply it is generalized in this IUnknown interface.. that's it
- cheers
redCat
^-^
@|@
|
|
|
|
|
Thanks for the immediate response.
But my doubt is different.
if we look at the idl file that is generated in a COM application we could find something like this.
[default] interface ICOMSample;
Will this [default] be associated with all interfaces. if not, why??
and What is the need of this.
Appu
|
|
|
|
|
[default] is an indicator to scripting languages such as VBScript which interface is the default one. Such scripting languages cannot navigate to alternate interfaces, so in effect they can only access the single interface marked [default]. This attribute is saved in the generated type library but doesn't otherwise affect the generated code.
Visual Basic 6.0 can access non-default interfaces but this feature isn't commonly used. You simply create a variable of the interface type (e.g. Dim o As IOtherInterface) and assign an existing object to that variable - if the class implements that interface, VB assigns the variable, and if not, an error occurs. Similar behaviour occurs in .NET languages.
If all your clients are C++ clients you don't need to worry about this attribute.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
using the [default] attribute, we are specifying that this interface is to be returned for the client by default at the time of creating object using the ProgID.
let us say the scripting client create an object for MSXML Parser using the CreatObject("Microsoft.XMLDOM") method.
by default IXMLDOMDocument interface is returned. here is where we can realize the use of this
[default] attribute.
there cannot be many [default] keywords.. one for incoming and one for outgoing interface is allowed that's all . also if you are not specifying anything, by default the first thing is taken.
^-^
@|@
- redCat
|
|
|
|
|
Hi folks,
I'm developing a DCOM Client/Server project under Win2000 SP4 (both client and server) with VC++ 6.0.
An object in this project has to interface with National Instruments Vision Builder 7, which DLLs are registered under \system32 folder (the package works with no problem)
In this object, I have to pass an UDT that is a struct containing a safearray of another struct and two integer (that is, the safearray contains the RGB Values of all the points of my image and the two integers keep the image size). These structures are shown below.
When I compile, I get MIDL warning 2368: Could not set UUID ... etc etc etc... but I've seen that this can be ignored with no problems.
Now, when I run both client and server, I get an error when preparing to pack the safearray. In facts, I call GetRecordInfoFromGuids to build my SafeArray with VT_RECORD. Before, I was not doing error checking and everything seemed to be alright, but I got crashes. Now, that I added an if (FAILED(hr)) statement just after the call, I get a 0x80029C4A value, that is "Cannot load type library/DLL".
Here's the structs:
typedef <br />
[uuid(394143BC-4672-4E14-85DB-A96EBCA5A417),<br />
version(1.0),<br />
helpstring("RGB Representation of a single point")]<br />
struct RGBValue_struct {<br />
unsigned char B;
unsigned char G;
unsigned char R;
unsigned char alpha;
} RGBValue;<br />
<br />
<br />
typedef<br />
[uuid(7F7037D8-C4D5-4b75-9C68-A9627EDE914B),<br />
version(1.0),<br />
helpstring("IVA_Data COM Wrapper")]<br />
struct COM_IVA_Data<br />
{<br />
SAFEARRAY(PointFloat) saPoints;<br />
int numPoints;<br />
int pointIndex;<br />
}COM_IVA_Data;
Here's the function call :
HRESULT Image2Variant (IVA_Image Source, COM_IVA_Image *Dest)<br />
{<br />
<br />
HRESULT hr = 0;<br />
SAFEARRAYBOUND sabRGB[2];<br />
<br />
sabRGB[0].lLbound = 0;<br />
sabRGB[0].cElements = Source.columns * Source.rows;<br />
<br />
hr = SafeArrayDestroy(Dest->saPoints);<br />
if (hr != 0)<br />
{<br />
sprintf(logMessage, "CAugVisionEngine - Image2Variant - SafeArrayDestroy Failed (%ld)",hr);<br />
WriteLogFile(logMessage);<br />
}<br />
Dest->saPoints = NULL;<br />
IRecordInfo *pUDTRecordInfo = NULL;<br />
hr = ::GetRecordInfoFromGuids(LIBID_AugSvrLib, 1,0,0,RGBValue_IID, &pUDTRecordInfo);<br />
if (FAILED(hr))<br />
{<br />
sprintf(logMessage,"GetRecordInfoFromGuids failed (0x%X). Invalid Argument.",hr);<br />
WriteLogFile(logMessage);<br />
return(-1);<br />
}<br />
<br />
Dest->saPoints = SafeArrayCreateEx(VT_RECORD, 1, sabRGB,pUDTRecordInfo);<br />
if (Dest->saPoints == NULL)<br />
{ <br />
WriteLogFile("Image2Variant - Array Cannot be Created");<br />
return (-1);<br />
}<br />
<br />
Dest->columns = Source.columns;<br />
Dest->rows = Source.rows;<br />
<br />
for (int i = 0; i < Source.columns*Source.rows; i++)<br />
{<br />
<br />
RGBValue TempValue = Source.array[i];<br />
hr = SafeArrayPutElement(Dest->saPoints, (long *)&i, &TempValue);<br />
if (hr != 0)<br />
{<br />
<br />
WriteLogFile("SafeArrayPutElement failed!");<br />
return (NULL);<br />
<br />
}<br />
}<br />
<br />
return (S_OK);<br />
}
Here's the method prototype where I make the above function call:
In .IDL:
HRESULT loadImage([in]BSTR FileName, [out, retval]COM_IVA_Image *IVAImage);
In .H
STDMETHOD(loadImage)(/* [in] */ BSTR FileName, /* [out] */ COM_IVA_Image *IVAImage);
Here's what I verified:
1) The typelib is both on source and in executable folder (on both machines);
2) The DLLs are all under \system32 folder. I have moved none of them to my executable folder.
3) proxy/stub DLL is correctly registered in both machines
4)
I'm really stuck. I don't know what to do and I had to release project to customer 2 months ago...
Thanks in advance,
Morenz
|
|
|
|
|
just a guess..
i have always seen iid name to be seen as class name..
RGBValue_struct_IID inplace of RGBValue_IID ....in ::GetRecordInfoFromGuids(LIBID_AugSvrLib, 1,0,0,RGBValue_IID, &pUDTRecordInfo);
if still problem persists ...need more info .. >>>>
cheers
vibhash
|
|
|
|
|
hi,
thank you for the reply!
(un)fortunately, it was my fault, because I have currently 2 versions of this project (the MFC and the Service ones), that are slightly different, and I used the wrong type library...
Thanks again!
|
|
|
|
|
Hi All, there is Strange problem that i am facing?
i am interested in COM?
i have a n/w server application (Say Server A)that registers component in ROT say CompA ( Apartment, created and registered from MainThread ).
The responsibility of this component is to query some results (one by one )from an Out-Proc Component (service, STA). The result fetching happen in 3 steps ( open, next, close).
now if the request comes to the Server A, the server spawns a new thread, the thread function gets the interface pointer from ROT ( item moniker ) and uses CompA to service.
calling CoCreateInstance per request, and the interface pointer is stored in map, mapped with request id, which is used by the client to fetch result thru the next([in]reqid, [out]result) fn..
the requst id is uniq and sent in all function calls, so that the CompA maps the result and client correctly..
now the problem is :
1. if the server is servicing for only one client, the results are proper.
2. if the server tries to service more than one client at the same time, the results are insconsistent (or) not getting partial results.
this seems to be a mind bender for me ??
by - Thanks in advance
redCat
what could be the problem?
is it a threading issue ?
moniker concept is used in wrong manner which goes inconsistent ?
hence i am using map inside the CompA - i have to used Critical Sections ?
is there any problem with RPC Channel (hence we are object is created from Moniker) ?
this seems to be a mind bender for me?
thanks in advance
- redCat
|
|
|
|
|
hi i want to know about the base classes or the obejects i declare in my class to make a transform filter with one input and 2 outputs.
|
|
|
|
|
Hi,
I just creted the Exe component and one obect using ATL Wizard,
and try to call that obects which gives just message box.
But I am getting the error "No such interface supported", could any body give the resolution for this.
Calling code :
ITempObj *pIExeObj = NULL;
hr = CoCreateInstance(CLSID_TempObj, NULL, CLSCTX_LOCAL_SERVER, IID_ITempObj,(void**)&pIExeObj);
Thanks & Regards,
Siva
|
|
|
|
|
what's the exact error and where???
may be CLSID_TempObj --> CLSID_ITempObj
cheers
vibhash
|
|
|
|
|
Hi,
Did you make your interface visible to the client?
Did you register the server?
You may need a proxy-stub DLL, that is present on server side (but must be built and registered manually), and must be copied (the DLL only) and registered also on client side.
Try it and make me know.
Regards,
Morenz.
|
|
|
|
|
Hi
I have created an application the interacts with maximizer CRM, everything was going as planned until i found one line of code that simply does not execute in the .NET environment.
This line of code is meant to tell the COM Object to search for a client by using their ID number, i found that if i execute this line of code in a VB6 project (just like i have been doing in VB.NET) it actually works, this is a bit of a pain as i have to create a separate VB6 .dll that will execute one line of code for my VB.NET application.
Does anyone know how i can solve this problem and execute the line of code successfuly in .NET?
I have added the two functions, first being the VB6 Function, second being the VB.NET Function
Regards
Robert Brown
This is the VB6 Code
Sub Find(ByVal ClientID As String, ByVal ContactNumber As Integer, ByVal List As Integer)<br />
' --------------------------------------------------------<br />
' Function: Main<br />
' Description: Examples use of SearchByClientId Method<br />
'<br />
' Arguments: sClientId: Local variable which receives<br />
' getfieldvalue return value.<br />
' Returns: n/a<br />
'<br />
' Comments: Maximizer should be active while<br />
' running this code.<br />
' --------------------------------------------------------<br />
<br />
Dim objMaxAttach As New MaximizerTLB.AttachToCurrentInstance ' Define CurrentInstance object of running Maximizer<br />
Dim objMaxCur As MaximizerTLB.CurrentRecord ' Define Current Record Object variable<br />
<br />
Set objMaxCur = objMaxAttach.GetCurrentRecordObject ' Set objMaxCur to Current Record<br />
<br />
' -------------------------------------------------------------<br />
' Use the GetFieldValue method to obtain the current record Id<br />
' then search for all matching records<br />
' -------------------------------------------------------------<br />
'sClientId = objMaxCur.GetFieldValue("IDentification")<br />
<br />
' ------------------------------------<br />
' Create new list whose IDentification<br />
' matches that of the current record.<br />
' ------------------------------------<br />
'Call objMaxCur.SearchByClientId(sClientId, 0, 2)<br />
<br />
<br />
<br />
<br />
'***************** this line does not execute in VB.NET ****************<br />
Call objMaxCur.SearchByClientID(ClientID, ContactNumber, List)<br />
'***************** this line does not execute in VB.NET ****************<br />
<br />
<br />
<br />
Set objMaxCur = Nothing ' Release object<br />
Set objMaxAttach = Nothing ' Release Object<br />
<br />
End Sub
VB.NET Code
Public Sub AddIndividualNote(ByVal ClientID As String, ByVal ContactNumber As String, ByVal Message As String, ByVal BatchID As String)<br />
Dim objMaxAttach As New MaximizerTLB.AttachToCurrentInstance<br />
Dim objMaxCurrentRecord As MaximizerTLB.CurrentRecord<br />
<br />
Try<br />
objMaxAttach.GetApplicationObject.ActivateWindow("Client")<br />
objMaxCurrentRecord = objMaxAttach.GetCurrentRecordObject<br />
<br />
<br />
<br />
'***************** this line does not execute in VB.NET ****************<br />
'search for the person<br />
objMaxCurrentRecord.SearchByClientID(ClientID, ContactNumber, 2)<br />
'***************** this line does not execute in VB.NET ****************<br />
<br />
<br />
<br />
objMaxCurrentRecord.UndoSearch()<br />
Catch ex As Exception<br />
Throw ex<br />
Finally<br />
objMaxCurrentRecord = Nothing 'release object<br />
objMaxAttach = Nothing 'Release Object<br />
GC.Collect()<br />
End Try<br />
End Sub
|
|
|
|
|
Good afternoon.
Where it is possible to take COM: Microsoft MAPI Control 6.0 for studio 2003?
Thanks!
|
|
|
|
|
I writing a COM Addin for Outlook using VC++ and ATL. I have a query.
Suppose _cmdBarBtn is of Office::_CommandBarButton type.
Now when I access its methods I have
_cmdBarBtn->PutCaption( _bstr_t( "Hello VC++" )) ;
and
_cmdBarBtn->Caption = "Hello VC++" ;
Both of the above code pieces do the same thing. Can anyone explain the difference between the two. Is one implementation faster than the other? Most of the properties have two implementations like the one mentioned above. Could anyone help me find the answer?
Thank you.
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|