|
Hi,
I have an ATL interface (IOLEDBConnectionPool) for which I want to expose a function
(Initialize) with a DBPROPSET (an OLEDB propertyset struct) but the MIDL compiler doesn't
recognize the DBPROPSET. If I use another variable-type and compile and then change the corresponding
.c and .h files afterwards it works just fine but it is not a nice solution so what can I do to make
the .IDL file compile (see extract from .IDL-file below)?
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(D5602000-F5DA-45A0-9A14-066B0D23AAE1),
helpstring("IOLEDBConnectionPool Interface"),
pointer_default(unique)
]
interface IOLEDBConnectionPool : IUnknown
{
[helpstring("method Initialize")] HRESULT Initialize([in] DBPROPSET *pPropSet);
};
....
Johannes
|
|
|
|
|
There are two ways you can get around this. One, add the definition of the DBPROPSET struct to your IDL so it know what you mean. This will work if the clients are C++, VB, VBScript and the like won't. Two, since the param you are passing is a pointer just use a LONG and convert in into a DBPROPSET* when you get it. This would be the prefered method.
|
|
|
|
|
Hi
I need to pass many variables from a client written in VB to a COM server written in VC++. My idea is to modify them by reference in the server. Is there any way to send a structure or a class, containing my variables? The types are int string and bool. Tips or links to articles/examples would be greate.
thanks
|
|
|
|
|
Can i open an ADE file with CDataSource to check it's status. Have tried various provider strings etc.
any ideas
Robbie G
|
|
|
|
|
I have built an activex control that I need to sign and package for network (&internet) delivery. MSDN make references to cabarc.exe and a Cabinet SDK as beening the only way to make cabinet files yet does not provide them on VC++6.0 only on VC++ 5.0 CD set. Is there a new way to make cab files that MSDN eludes to tell me about? Where on Microsoft site can I download cabarc.exe? I am lost!
Many Thanks
Gary,
|
|
|
|
|
|
Thanks Mike,
I spent a few hours yesterday chasing my tail on the MSDN site. A fellow developer suggested searching www.download.com (cnet site). There were a few CAB utilities there that seemed to do the trick so I am out of deep water for now! (Freeware/Shareware once again does the trick... many thanks to all producers of such software)
Gary.
|
|
|
|
|
hi
anybody has any code to drag and drop a url/link from
a IE control. the code would be in c++ and com api.
thanks.
From
Am4000
|
|
|
|
|
Can anyone tell me how to compile the proxy DLL for an .exe COM server which has interface functions that take a BSTR parameter. The VC 6.0 compiler says the proxy requires at least NT 4 to run. This server should run on 9x, NT 4/5
|
|
|
|
|
I try to create an automation interface to my application, and I run into a problem. I have an application root that is creatable, but to create input for other objects in the automation model I need to CoCreate other objects as well. The problem is that new instances of my exe-file is created when I try to create these other objects. I want them to be created from the running instance, not that another instance is created for each CoCreateInstance. How should I do this?
Pål
|
|
|
|
|
Sounds like you are descripbing aggregation/containment. Try something like this.
// Header
CMyObj1 m_Obj1;
CMyObj2 m_Obj2;
// CPP
OnFinalConstruct
{
CoCreateInstance(MyObj1);
CoCreateInstance(MyObj2);
}
|
|
|
|
|
I think I was a bit unclear about the problem description. The object model in for instance Excel has several coclasses (Application, Sheet, Chart etc) I obviously do something wrong, because creating my coclasses from VB result in a new instance of the exe for each coclass. What mechanism ensures that the creatable objects are created in the same instance? Does anyone know?
Pål
|
|
|
|
|
hello.
i'm stuck with an issue that it is easy to write in an MFC app but because i HAVE to use ATL it makes life VERY difficult. I have to rewrite the following procedure from VB into VC++.
The VB program does this:
- checks to see if a particular database is open
- if it is get the application object and run a sub in it (through COM)
- if not then set a registry key and open the database
I can do the last thing easily but check and getting the actual object (as an IDispatch pointer) is the part I'm having trouble with.
Any ideas?
Rob Grundel
|
|
|
|
|
Checking to see if the db is open is a simple task with ATL and OLE DB. If you create an ATL project and insert a database consumer the wizard will walk you through connecting to it. Once you have this should have access to everything you need. The VB project probably uses ADO, which sit on top of OLE DB. See where this is going...
|
|
|
|
|
Hello
use oledb template like CDataSource to check the database
status. you have to include atldbcli.h.
From
Amitava Banerjee
|
|
|
|
|
When I right-click the interface and choose "New Method" in the method creation dialog the return type field is disabled. But I need to create method that returns "short". How do I do that?
|
|
|
|
|
Interface function already return a HRESULT, and your owner return value must be defined in the last argument with [out,retval], example:
myFunction([in] long id, [out,retval] long* pNumber)
By the way, you must not use "short" type , instead using "long".
|
|
|
|
|
What's the difference between COM and OLE?
|
|
|
|
|
A couple of years.
What we refer to as COM today was called OLE a few years ago. Just about every book dealing with COM has a chapter explaining the origins.
|
|
|
|
|
What's the difference between Interface and dispInterface?
|
|
|
|
|
A dispatch interface is usually used by late bound languages such as VB or JavaScript to call, or invoke, methods on your object.
|
|
|
|
|
as mentioned in the above comment the difference is the late binding but the actual differnce is under the hood in the depths of the COM architecture. Dispinterface are just IDispacth Interfaces and don't rely on v-tables. Custom interfaces (non-IDispatch) use vtables and are much faster than IDispatch interfaces. But alas VB has no support (or had no support... i hear the latest release does) for v-table driven interfaces.
Hope this helps some.
Joseph Dempsey
jdempsey@cox.rr.com
Joseph.Dempsey@thermobio.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
Hi!
I have developed a context menu shell extention.
It is registered successfully but it doesn't work.
Can anyone tell me what is reason behind it.
Thanks in anticipation.
|
|
|
|
|
Hello,
Is there another way of detecting if the client was crashed rather than
pinging it ? The same question for the server rather than to call a method
and to look at the RPC error.
Can it be possible to diagnose the origin of the error ?
In another words, what are the causes of the DCOM server crash ?
The causes can be the network, the computer or the server (software) which
was dead or was blocked... or a mixture of all of this.
Can it be possible to prevent it ?
Thanks by advance for your answers
|
|
|
|
|
Why do you care if the client crashed, especially with out of proc components. Your server is only kept alive for the time that clients hold refs to it. If the client crashes, DCOM has a ping mechanism that will shut your server down in 6 minutes. There could be anything that could cause a DCOM error including all of what you mentioned. If you are concerned you could create a thread that goes off and instantiates your DCOM server. The main thread can then carry on its merry way. You can even use WaitForSingleObject to set your own timeout so that you don't have to wait an extended period of time to see if the creation or call failed.
|
|
|
|