|
Hello!
I have an application written i VC++ (Visual C++ 6.0). This application already connects to several COM-objects and listens to events from them. This works very well.
My latest COM-object is written in C# (Visual Studio 2005). I connect to this object the same way, and listens to events (delegates) from the object.
But the events only works on my computer. I works in boty release and debug. I have tried to copy the software to serveral other computers, but then I receive no events. It connects to the object, and I can call functions in the C# COM-object, and display the return value, but OnXmlEvent(LPCTSTR text) is never called in my C++ application.
Any Idea about what's missing? For testing porposes I have created a console application in C# that connects to the C# COM-object, and this works fine on any computer, so I think my problem is the C++ application.
Am I missing a DLL or library?
Frode
|
|
|
|
|
Hi,
I have written a program in C# such that it creates a dll file at runtime using the CodeDOM techology and after creation the program calls a function from the dll file. This has been created with the winforms. It has two button and two text box. txt_box1 is to get a string from the user and btn1 is to create a dll file that retuns the string in txt_box1 when called. btn2 is used to call the dll file and the result is shown in txt_box2. The problem i encounter with this is, when i run this program for the first two time it creates the dll file and returns the string correctly, but when i try for the next time it exits. what i have to do to rectify this problem. Please help me.
If you can DREAM it
you can DO it
Natarajasivan D
|
|
|
|
|
Hi,
we have an SingleInstance-COM Object which works as Data-Buffer between a SAP-GUI and a graphical configurator (OpenGL). This works about 5 years. Original developed with VC 6, compiled with VC2002, VC2003, VC2005 and now with VC2005 SP1 over the years. Since we installed this object compiled with VC2005 SP1 there is an error "Server busy" while using the COM-object.
How can i get the position of the problem ?
Any tipps or hints or tools that can help me to solve the problem ?
Can i get detailed information which server is busy ?
In another context we had an identicaly error message. We tried to open a PDF file via IE on a new installed PC. The Acrobat Reader needs to confirm a dialog the first starting time. Nobody can see this dialog in the IE-Job. Starting an autark PDF file once, solves the problem.
Thanks in advance,
Howie
ps. Switch back to the old COM-object has not this problem. Virus checked, etc.
We know nothing between the technical communication of SAP and the COM object.
-- modified at 2:56 Friday 22nd June, 2007
|
|
|
|
|
hai everyone
i want to add activexobject("WScript.Shell") in my aspx page
plz tel me step by step
thanks
Dhatchinamoorthy.R
9894824838
|
|
|
|
|
I've been writing an addin for Outlook which requires it's own print dialog (in c# using P/Invoke). All good and well, but when I load the printer properties using the winspool.drv function of the same name I get a different properties dialog compared to the one accessed through the existing Outlook print dialog.
Does anyone know why this happens and if there is a way around it?
Thanks in advance
Dave
|
|
|
|
|
Figured it out - apparently Outlook calls DocumentProperties rather than PrinterProperties.
Dave
|
|
|
|
|
Hi,
We want to use COM+ to hold our business objects and turn on Object Pooling to persist Business Objects for each Web Session. What is the best way to do that and how? Should we create a COM+ that holds business objects for all sessions ( a collection of sessions that hold a collection of Business objects for each session ), or create COM+ object for each Session to hold all business objects?
Regards,
Babak
Babak Ansari Jaberi
Software Developer/Designer
|
|
|
|
|
Hi Experts,
I am using third party com Dll interafces.But sometimes the interfaces return E_OUTOFMEMORY EXCEPTION.So tell me how to release com interface.
Thanks
|
|
|
|
|
The exact mechanism depends on how you're using it. If you're using #import or CComPtr<> smart pointers, then you release the interface by setting the pointer to NULL. If you aren't using smart pointers in this way, you have to call the Release() method.
Note that if you copy a pointer without using AddRef() or QueryInterface(), the object may go away unexpectedly. Similarly, if you use AddRef() or QueryInterface() with no corresponding Release(), the object implementing the interface will not necessarily disappear when you expect it to..
Steve S
Developer for hire
|
|
|
|
|
What language are you coding in?
In VB, just make sure you set all of the objects you create to Nothing as soon as you're done with them:
Set MyLibraryInterface = Nothing<br />
Set MyBusinessObject = Nothing
In many situations, you don't really need to do this unless you're creating a lot of objects that don't fall out of scope right away
In C++, you just call ->Release() on your interface pointer.
MyComObject* pMyComObject = NULL;<br />
(send the pointer into your class factory CreateInstance call here)<br />
(do your business logic here)<br />
<br />
pMyComObject->Release();
Hope this helps.
|
|
|
|
|
I have implemented both applications using COM & DLL. But i don't find out any significance difference.So if anybody knows about it,then please reply me as soon as possible.
Regards,
Pankaj Sachdeva
|
|
|
|
|
[Why the laugh?]
A DLL is a set of code packaged into a library which can be used by your application, but is limited to working "in-process". That means it's loaded into your EXE, and has the same access to the memory allocated to the process as any of your other code. Similarly, it runs with the same privileges and user identify that your process does.
A COM component (or object, if you will) on the other hand, is a package of code which can be used by your (or any COM-aware) application, possibly even script hosts (VBScript, JScript) if the component implements the necessary supporting functionality. It provides mechanisms for working across process and machine boundaries, and allows (well, insists, sometimes) the configuration of security such that the component may execute under a different identity to the clients of the component. A COM object can implement or provide multiple interfaces, support aggregation, callbacks, and will implement lifetime management.
If your only exposure to COM is writing an ATL-based DLL, then it is not surprising that you haven't really appreciated the differences. Where I am (and where I was before) make heavy use of COM, COM+ and DCOM to implement a range of application servers (some of which are also services). None of them are 'network-aware', in the sense that there is no client code which deals directly with locating a component on a remote machine on the LAN and talking to it. COM/DCOM deals with all the plumbing issues, so you can concentrate on making the applications do what they are supposed to.
Many of these run 24/7, stopping only for software changes, and sometimes not always then!
Steve S
Developer for hire
|
|
|
|
|
pan_angel wrote: I have implemented both applications using COM & DLL
The above line doesn't match well with the below one.
pan_angel wrote: But i don't find out any significance difference
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi,
I'm using one COM component(exe), which implements the connection points also.
I have a client which implements Sink interface also. The event the server fires is a method with a single argument BSTR. When the server fires the event, client gets the notification, but the BSTR value is invalid(empty string).
The problem is also seen with ULONG parameter also. Please suggest a solution, and please
suggest is it a good idea to have parameters in the event notifications.
Also if two clients are connected to the server, only the client which caused the event to fire is getting the notification.
Thanks and regards,
Raja Pratap.
|
|
|
|
|
Could you post a bit of your code so we can see where the problem is?
---
Hakuna-Matata
It means no worries for the rest of your days...
It's our problem free, Philosophy
"I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."
|
|
|
|
|
The problem got soleved.
We have to make the server free threaded and make the class implementing the interface singleton and we need to in _tWinMain.. make sure that CoInitializeEx gets called.
Just trial and error caused a break through.
Thanks and regards,
Raja Pratap
|
|
|
|
|
Hi
I am trying to understand relation between queryinterface and cocretaeinstance. I read so many things still dont understand.
(For cocretaeinstance) In MSDN it says:
"This function creates on the local system a single uninitialized object of the class associated with a specified class identifier. "
I understand that
We use cocreateinstance to take instance for a class and we query for a supported interface with queryinterface.
But if we use COM for using Interface instead of class object.
So why do we take instance of a class? Isn't concept of COM using Interface instead of class object. So hiding implemantion details and avoiding name mangling etc... So why do we take a class object?
I dont understand here.
In what conditions do we need/use cocretaeinstance and queryinterface together? And in what conditions one of them is enough?
I hope i could explain the problem.
I am looking for your answers
Thanks.
|
|
|
|
|
I guess, one cannot take an instace of a COM class...As it is still abstract...
It is passed as a parameter to one of the CComObject<> varaiants to instantiate it..
If you want to access other interfaces supported by the coclass, then it can be done by queryinterface-ing the already obtained interface... instead of re-creating the Object instance...
Hope this helps,...
raja
|
|
|
|
|
CoCreateInstance will give you an instance of a class of object (defined by the CLSID), and allow you to reference it via an interface (defined by the IID).
You can then ask the object for a different interface via QueryInterface.
As an example, imagine an object which displays data onto a device context. This uses an 'IRender' interface, which allows you to specify stuff like where to render to, and stuff like a zoom ratio, etc. But the object also supports the IPersistFile interface, to allow the saving/loading of the object to/from file.
The only way to get to IPersistFile from IRender is via IUnknown's QueryInterface method.
If you only use simple objects, they may only implement one (custom) interface, although in practice IUnknown must always be supported as well.
Does that help?
Steve S
Developer for hire
|
|
|
|
|
|
Hello
How can i change the CLSID and progid for already existing projects.Should i generate this for each project using guidgen.exe?I want to be able to load the dlls from a different target path, as a seperate plugin.is it sufficient to change the clsid alone or should progid needs to be modified as well? What will be the efficient way to do this.
Thanks
|
|
|
|
|
Dear all,
I want to write a Visual C++ program which interacts with a COM dll provided by a company. I have registered the dll and generated the .tlb using regasm, and now I'm facing a big problem, which is probably due to some very basic/stupid error:
<br />
#import "D:\programs\Autodrop\AutodropAutomation.tlb" no_namespace<br />
<br />
int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
HRESULT hr;<br />
<br />
hr = CoInitializeEx(NULL,COINIT_MULTITHREADED);<br />
<br />
if (SUCCEEDED(hr)) {<br />
CLSID CLSID_clsAutomation;<br />
hr = CLSIDFromProgID(L"AutodropAutomation", &CLSID_clsAutomation);<br />
<br />
LPOLESTR clsidStr;<br />
hr = StringFromCLSID(CLSID_clsAutomation, &clsidStr);<br />
<br />
clsAutomation *aac = NULL;<br />
<br />
hr = CoCreateInstance( CLSID_clsAutomation,<br />
NULL,<br />
CLSCTX_INPROC_SERVER,<br />
__uuidof(clsAutomation), <br />
(void**) &aac);<br />
<br />
if(SUCCEEDED(hr)) {<br />
cout << "The COM server has been successfully created!" << endl;<br />
long feedback = aac->Init("Test");<br />
} else {<br />
cout << "The COM server has not been created: ";<br />
}<br />
}<br />
<br />
return 0;<br />
}<br />
<br />
When trying to compile this code, I get the following error:
InkjetController.cpp<br />
.\InkjetController.cpp(67) : error C2027: use of undefined type 'clsAutomation'<br />
d:\documents\visual studio projects\inkjetcontroller\inkjetcontroller\debug\autodropautomation.tlh(23) : see declaration of 'clsAutomation'<br />
.\InkjetController.cpp(67) : error C2227: left of '->Init' must point to class/struct/union/generic type
Now, the point is that the method Init(String) DOES exist for clsAutomation:
Function Init(ByVal DatabasePath As String) As Long
Member of AutodropAutomation.clsAutomation
I saw many examples which access methods just by using this syntax, I do not understand what does not work. I tried a lot of work-arounds, but none of them worked up to now...
Thank you very much for your help,
Grégory
|
|
|
|
|
Hi
Am working on an application which is a plugin in a host application. To load an image the startup calls from the host are passed via an interface A and calls are passed to a package handles all the dll loading and initialising the application.Currently am loading the dlls from particular location , Location A.
The plugin A will be used as such and no more development will be done on that.
My goal is to load a second plugin from the host, which would be using the same code base, but development will be carried on moving forward.Essentially this has to load the same dlls but a different version and the code base is going to be updated.The dlls for the new plugin will be loaded from location B.
Experts in the group, what is the best approach to achieve this? As dlls are identified by GUID,so only one version of the dll can be registered at a time in the registry. Should i change the dll name and GUID for the entire application?IS this feasible?
Thanks a lot!
|
|
|
|
|
Hi all.
I'm having a really annoying issue generating a type library from a COM component written in .NET. Actually the class library was coded by another employee who has since left, so I am stuck trying to properly compile it.
Basically there is an interface IParameterData that has a number of properties all starting with I (upper case i) and ending in ID. However, when inspecting the generated type library the case has been changed on the first I (to lowercase) and the final D. This happens on 4 out of roughly 12 parameters.
The strange thing is that the type library is generated fine on one particular pc, but on 3 others I have tried it is incorrect.
Has anyone had similar issues with this? Is it because of old entries still in the registry? I have tried deleted old registry entires but to no avail.
Any help with this would be greatly appreciated
|
|
|
|
|
|