|
Take a look at the COM articles here on CodeProject for ideas. Frankly if you need to ask this question you may like to reconsider this task. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Hi all
we have com objects which needs to be shared between two worker threads.to provide effective
synronization b/w worker threads we have choosen Single Threaded Apartment(STA).i am able to register
and retrieve the interface from GlobalInterfacetable successfully with the help of
registerInterfceinGlobal and GetInterfcefromGlobal api's.but the problem comes up when i invoke any
method with the interface retrieved from Globalinterfcetable.the HRESULT status is 0x80010105: The server threw an exception.
can any one tell how to sove this issue
Thanks in Advancesukumar
|
|
|
|
|
Hard to say without seeing your code. Are you doing something like this:
g_pGIT = 0;
ATLTRACE("Messemger: Calling CoCreateInstance on CLSID_StdGlobalInterfaceTable\n");
hr = ::CoCreateInstance(CLSID_StdGlobalInterfaceTable,NULL,CLSCTX_INPROC_SERVER,IID_IGlobalInterfaceTable, reinterpret_cast<void **>(&g_pGIT));
if(FAILED(hr))
{
nErrID = IDS_CREATE_GIT_FAILED;
__leave;
}
hr = g_pGIT->RegisterInterfaceInGlobal(m_pIWebLog,IID_IWebLog, &g_dwCookie);
if(FAILED(hr))
{
nErrID = IDS_REG_OBJ_IN_GIT;
__leave;
}
|
|
|
|
|
You can consider CoMarshalInterThreadInterfaceInStream() and CoGetInterfaceAndReleaseStream() functions as well.
|
|
|
|
|
Make sure that
- all threads that create COM servers are pumping messages, i.e. they are UI threads
- every thread that do any kind of COM stuff initializes the COM library with a call to
::CoInitialize() or one of its equivalents - your proxy-stub is properly registered, or your typelib is properly registered if your doing typelib marshalling
Using the GIT for marshalling works very well.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hello,
I have to compile COM components written in VC 6.0 or edited and
modified in Visual Studio 2003 in Visual Studio 2010. It is giving
error messages like
' error C1189: #error : This file requires _WIN32_WINNT to be
#defined at least to 0x0403. Value 0x0501 or higher is recommended'
IntelliSense: #error directive: This file requires _WIN32_WINNT to be
#defined at least to 0x0403. Value 0x0501 or higher is recommended'
It given the error in the conversion report that atl support is
eliminated.Can any body tell a way around to compile and build COM
components that were originally written in VC 6.0 or Visual Studio
2003.NET
Regards
Muhammad Usman Khalilmodified on Tuesday, February 16, 2010 7:32 AM
|
|
|
|
|
The compiler is telling you what is necessary, so you need to do what it says. Using newer compilers/libraries than were available in VC 6.0 means you have to change up to the new rules, and fix anything that works in a different way. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Hi All,
I am using one com dll and have multiple clients on the same machine which are creating pointers for same interface, so is there can be any conflict.
Example:
SomeComComponentLib::IsomeInterface objInterfaceptr;
.....create instance
Now all the client applications are using objInterfaceptr in same way...Please provide me some suggestion to avoid conflict.Thanks A Ton
Ash_VCPP
walking over water is just knowing where the stones are.....
|
|
|
|
|
I guess there won't be any conflicts as COM components are not confined to a single process.
|
|
|
|
|
I'm trying to implement a COM obj. IUnknown, IDispatch based with automation.
I’ have implemented standard COM in plain C (it is registered - with name, CLSID, InProcServerPath...).
The client for this obj. in C uses CoCreateInstance and it works fine.
CoCreateInstance refers directly to Interface thru obj. CLSID and interface IID.
I'd like to expand this implementation and provide an Automation for this object.
At the current moment when I'm trying to implement a client in script language - the client requests for IID_IUnknown, IID_IDispatch (inside ClasFactory), but not for IID of my Interface.
When I implemented IDispatch methods - GetTypeInfoCount returns E_INVALIDARG.
The Question is how to Implement an automation in plain C, with no IDL, TypeLib etc...
Any Suggestions might be useful.noel
|
|
|
|
|
|
|
You're in the wrong forum.
COM here stands for Component Object Model and not serial port.
|
|
|
|
|
Hi all,
Is it possible to read / write data to / from the clipboard using a COM interface? I'm writing a Silverlight app and the SIlverlight framework only allows for reading & writing text, I however need to write a JPEG byte array, and I'm running as a trusted application so I have extensive COM available.
My second question is around how to write binary data to the clipboard so that Excel sees it as an Image (SL does not have an Image object type), anyone ever done that before?
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|
|
|
I have a regular DLL created in C++ that can run VBScript procedures from a VBScript file. The DLL is able to pass variant strings and safearray as parameters to script procedures. However, for a vector of name-value pairs I want to pass it to the script procedure by wrapping the vector in a COM class and passing its IDispatch pointer as parameter to the script. Is it possible to have a COM class and create the COM object inside a regular DLL, and then get its IDispatch interface to a variant variable? If yes, how (sample codes if possible)?
|
|
|
|
|
If you want a set of name-value pairs, why not convert the vector to a VBScript Dictionary[^] object?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
Looks like it will solve the problem since it has IDictionary interface that I can use in C++, and it will be easier to implement than creating COM object in the regular DLL. Thanks, Stuart!
|
|
|
|
|
Hi I got a requirment like ,
I have student interface IStudent(has properties like name, age, course), similarly ICourse (has properties like course name, student name).
how do i get list of students who attending a particular course ?
thanks
|
|
|
|
|
Enumerate the values of each, compare and count. There is not enough information in your question to provide a sensible answer.
MVP 2010 - are they mad?
|
|
|
|
|
This looks like a typical RDBMS "requirement".
|
|
|
|
|
yes this my qn looks like RDBMS query , but is it possible to do that in COM >?
|
|
|
|
|
hi
Microsoft.Office.Interop.Excel.ApplicationClass ExcelApp = new Microsoft.Office.Interop.Excel.ApplicationClass();
// in this line of code:
ExcelApp.Application.Workbooks.Add(Type.Missing);
error:
Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))
can any one help me ?
H.R
|
|
|
|
|
What exactly does it do? I have been browsing the Direct3D API code and I see most interfaces are declared using DECLARE_INTERFACE_ providing the derived interface name along with the IUnknown base as that is what DECLARE_INTERFACE_ is for; deriving from a base. What I've read elsewhere is that DECLARE_INTERFACE is for declaring interfaces when there is no base interface but my impression was that all interfaces derive from IUnknown somewhere up the tree so what does DECLARE_INTERFACE do?
|
|
|
|
|
When I look at where it's defined, I see these comments:
* DECLARE_INTERFACE(iface) is used to declare an interface that does
* not derive from a base interface.
* DECLARE_INTERFACE_(iface, baseiface) is used to declare an interface
* that does derive from a base interface.
Note the distinction between DECLARE_INTERFACE and DECLARE_INTERFACE_
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
MVP for 2010 - who'd'a thunk it!
|
|
|
|