These error codes are RPC_S_UNKNOWN_IF and RPC_E_DISCONNECTED respectively. If you're just seeing them in the debugger's output window, and they're being handled - you don't get an unhandled exception message box - I wouldn't worry about them. IIRC the RPC layer which underlies COM does use exceptions to report problems, rather than returning error codes.
It probably just means that you're using DCOM and the target machine either isn't responding, isn't running the same OS as the client, or disappears while you have a reference to an object. I think you might also get RPC_E_DISCONNECTED if the process hosting an out-of-process object crashes or otherwise terminates while you've still got a reference open.
I encounter errors while trying to compile com project with idl file attached. i assume the file is ok, because someone used it before, but perhaps i could fix that by changing compilator configuration...
MIDL2311: statements outside library block are illegal in mktyplib compatibility mode <br />
You may need to specify the /mktyplib203 command-line switch when you compile your IDL file.<br />
Note The Mktyplib.exe tool is obsolete. Use the MIDL compiler instead.
I built a control using the MFC ActiveX control wizard in VC6 and I am able to add methods, properties, and events just fine. When the control is created, I start a new thread (CWinThread-based) in the constructor. The control is not visible during runtime; rather this worker thread runs in the background (reading the serial port and doing parsing operations) and sends back information to the host application via events. The way I did this was to make the thread class a friend of the control class so that the thread class could directly call the FireEvent___ functions. Is this the right way to do this? I've Googled this and also searched cp here but came up short on specific examples.
I ask this because when I test the control on VB6, sometimes the entire VB IDE shuts down (crash). When I test the control on VB.NET 2005, the event callback functions can't access any of the form controls (because the event function is called under the context of the control's worker thread). In LabView, the events fire back but all the arguments are zero; not the values that were passed to the FireEvent___ function (they are all signed long).
I have "inherited" an application that has the ability to start a COM service to communicate through VB to an Access database. It also can run in a standalone mode, where the service is not started and there is no network connection.
My problem comes in with regional settings. In the system where the service is running, if I do not format dates in US format in my sql statements, the access database does not process them. However, if I run the application on the standalone system without formatting the dates in the sql from VB it works fine (access accepts the sql statements and processes them). Naturally, if the regional setting is US all is fine, but when any other regional setting is chosen, the system with the service running does not update, while the standalone system does.
Does anyone know if Access has a way of knowing whether it is associated with a "networked" application or not? Or is this some how related to the COM service?
This is probably that the system default locale on the computer is set to English (US). The COM service will run under whichever user it's configured to, but often this will be the default of SYSTEM or LocalSystem. I'm not sure if the COM service infrastructure loads the user's profile, so you may find that the system default locale is being used even if you've configured the service to run as a normal user and that user has a different locale selected.
You should consider using parameterised SQL statements rather than using string concatenation to build a SQL statement. See the documentation for CreateParameter on the Command object. For Access/Jet, you'll want to use a ? as a parameter placeholder.
I have written a COM add-in for MS.Word in MFC. I can get the content of a document, and control ms.word's document successfully. However, I can't do functions as ms.Equation 3.0 does, such as adding a mathematical symbol. I don't know how to do that, how the ms.equation does as well as what ms.equation solves in detail. I'm in dark. Would you like to give me some advice, or point me some webpages. Thanks...
I fill a pointer to a com object via CoCreateInstance. Now I use this one and must "get rid of" the connection and reinstanciate this object. Tried this via
Release() method, but this seems not to be enough. Any one an idea?
If you are talking about something like delete Object; then a call to Release should work for you. You have to make sure that there are no additional references to this object of yours. Release will return you ULONG which is the count of existing reference to this object.
Thanks for the fast answer. Reference count is 0 afer release but the object doesn't destroy correctly. Posted the same subject in C++ Forum and got an answer that makes me think that the com dll has bugs. If you're interested to read my other comments please read the thread in the c++ forum. Thanks again for trying to help.