|
Hi.
I need to get the user's active window text from the VS.Net IDE.
so far this is what I know:
<br />
using namespace EnvDTE;<br />
<br />
CComPtr<EnvDTE::_DTE> m_pDTE;<br />
<br />
CLSID clsid;<br />
CLSIDFromProgID(L"VisualStudio.DTE",&clsid);<br />
<br />
CComPtr<IUnknown> punk;<br />
HRESULT hr = GetActiveObject(clsid,NULL,&punk);<br />
<br />
Document *ADocument;<br />
m_pDTE->get_ActiveDocument(&ADocument);
<br />
Now how can I get the full text from it ?
Thanks in Advance,
David
|
|
|
|
|
Hi,
A friend of mine told me that I can boost performance in I let my COM clients use include _i.h instead of import tlb.
Is that correct?
Thanks
|
|
|
|
|
There should be very little difference between the two. The .tlh file generated by #import produces code which is typically virtually identical to that generated by MIDL in the header file, at least for the raw interface.
Optionally and by default, #import also generates wrappers that use exceptions to report errors and extended Visual C++-only syntax to support properties. This makes it syntactically nicer to use the interfaces. Exception handling is significantly slower than error code checking, but it's the user's choice whether to use these.
If you use the TLB there are limitations on the types you can use for parameters in your interface - for example, all strings must be BSTRs, and all arrays must be SAFEARRAYs. However, you need to conform to these requirements anyway for scripting, Visual Basic and .NET interop support.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi,
I need to write an SDK for my system which is based on a proprietary camera. I thought of using COM for the interfacing of the SDK, but from what I read, I can't find a way not to marshal the video data.
I need a way to initialize a callback function and transfer a pointer to a grabbed frame. Can this be done with COM without marshaling the image data which is CPU expensive?
Is there a better recommended way of doing this? (My camera is not a standard camera, and has many special configuration and communication options).
Thank you very much,
Gil
|
|
|
|
|
how can i pass object/class/struct from any client to COM component and store it in ATL collection class which implements IEnumxxxx interface.
k.vamseedhar reddy
|
|
|
|
|
you can model the class/struct with an interface and pass that interface to the component.
|
|
|
|
|
You can use IUnknown * or IDispatch * interfaces to send the objects to COM by using reinterpret casting
Knock out "T" from CAN'T
You 'CAN' if you think you 'CAN'
|
|
|
|
|
i am getting this error after adding "mfc as shared dll", and inluding afxsock.h
#error WINDOWS.H already included. MFC apps must not #include <windows.h>
Thanx in Advance
Z.A
|
|
|
|
|
Hello, for a few weeks now I have been trying to get my directX-application work in internet explorer. The problem is, i don't know what lines of code i need or how to make a user control or activeX control work in internet explorer. My application scrolls text over the screen using DirectDraw. In a form as a stand-alone application, it works fine. But when I try to use the code in a ActiveX Control it shows sh*t!
Can anybody help me? I'm really desperate!
|
|
|
|
|
Hi,
i am working on Project(i.e distributed application) involves ATL COM component and MFC GUI application. The arcitecture of of the project is as follows
--> The ATL-COM component project (named as PAObjects) generates PAObjects.dll. This project is having few function written to querey the
database in MS SQL server 2000. These functions are exposed through COM interface.
--> I wrote MFC GUI application that make use of function written in above ATL-COM component project.
--> The above two project modules are running on windows 2000 server operating system.
Actually, I want to debug the functions written in ATL-COM component project (named as PAobjects). The following steps i followed to debug the
ATL-COM component.
1) In COM DLL project, i set the break point at the required location within function. Also in visual studio IDE project--> setting option, Under Debug Tab, for "executable for debug session" , i provide path to my MFC application EXE.
2) Also set Debug break point in MFC application, from where call is made to ATL-COM project function.
3) i compiled both the modules in Debug mode. Also registered the COM dll.
So when i am trying to debug the function in ATL-COM project, Control is not at all comming to function in ATL-COM project.
Can anybody suggest me, what else setting is required to debug this function.....Any Artical or E-book or Link focusing on this debugging issue will helpful to me..
thanks
Nimesh Patel.
Nimesh
|
|
|
|
|
Which project are you debugging? If you debug the MFC exe, then any breakpoints (using software, like Pressing F9) will not break execution in the DLL.
1- Either you can run the exe using the DLL project , and put breakpoints where needed in the DLL code.
2- Or, put a breakpoint on the function call in the exe like this:
pDll->SomeFunc();//---Breakpoint here---
Then step-into (F11) to enter the function in the dll code.
this is this.
|
|
|
|
|
Yes i am using first option ,
1) Either you can run the exe using the DLL project, and put breakpoints where needed in the DLL code.
i was following the same step but still it is not landing up into COM dll project breakpoints at all.
thanks
Nimesh
Nimesh
|
|
|
|
|
One more thing you can do: Put hard-coded breakpoints in the DLL code and compile and debug it:
__asm int 0x03;
And are you using a DCOM service? That would require a different methodology.
this is this.
|
|
|
|
|
And are you using a DCOM service? That would require a different methodology.
Yes I am using DCOM service... I like to know the Methodology which is requried for this. If u know good web-link exploring this topic or E-book or article ... Let me know ... which help me clearing my understanding .....
thanks
Nimesh
Nimesh
|
|
|
|
|
|
Hi all,
iam working on WMI(windows MAnagement Instrumentation). i have created a sample application using WIn32_process class . iam able to display messages when an Process is opened or closed.
now what i want to do is to create an object and then register a call back function . This class also take process names through another method . this class should call the above callbackfunction when one of the process(taken through the above method) is either started or exited.
can you please suggest me how to procedd with this task.
Thanks in advance
abhi
|
|
|
|
|
Hi all
i have a task on Server/client communication using DCOM.
genrally we communicate to server from client(we call component interface methods from client by getting the interface pointer).
But i want to communicate from server to client. i want to send messages from server to client.
Can you please suggest me how to proceed with this,
thanks
abhi
|
|
|
|
|
hi
i want to do some operation on opened file.
that means the file is already opened by
other process in exclusively mode.At the same time
i want to do some operation on that file like copy,open..
in my program.
is it possible in COM?
can anyone help me please?
nirmal
|
|
|
|
|
This issue is not releated to COM.
Steve
|
|
|
|
|
is there a pre-existing implementation of IStream (or ISequentialStream) that wraps around pipes or sockets or something? I want to send lots of data between two COM objects in different apartments & need something efficient
--Jason
|
|
|
|
|
The normal way to solve such a problem is simply to marshal a pointer to the receiving COM object to the senders apartment and then the sender can simply call a method on the receiver (really the receiver’s proxy) and push the data at it - There is no need for pipes and the like.
Steve
|
|
|
|
|
Sure, that's fine if you have a finite amount of data transfered synchronously from object 1 to object 2.
But what if object 1 is pumping out an infinite (or at least, indefinitely large) stream of data, say in 100 byte chunks, one chunk every 100usec, and I want object 2 to be able to process the stream of data at a slower rate (e.g. 1000 chunks every 100msec, or whenever object 2 gets a chance)?
(think of MP3 or video streaming, though in my case the application is completely different)
--Jason
|
|
|
|
|
In that case the receiver could simply queue the data and not process it immediately. The sender could call CoTaskMemAlloc to get some memory and fill it, then call the method on the receiver’s proxy and give it the memory block. The receiver would stash the address of this memory block in a queue. When the receiver gets around to it would process it and free the block by calling CoTaskMemFree .
Steve
|
|
|
|
|
right, but then I have to take an RPC call every time the sender wants to send something. This is awful expensive. And at a source rate of 1 chunk every 100usec, it essentially won't work unless the two objects live in the same apartment. Some informal experiments seem to indicate inter-apartment calls on my CPU take between 100us and 1msec depending on how much data is marshalled. Actually in a lot of cases my chunk size might be 10 or 20 bytes every 100usec, so there's a tremendous amount of overhead here for the data rate.
I've thought of having the sender batch it up into larger chunks arriving slower & doing essentially what you're talking about, having the receiver queue things explicitly (which is what I'm doing now to get around the problem), but that's a bit kludgy. The major downsides in my application are that [a] my object's clients have to know about & manage the batch-processing (not that bad, but nevertheless a pain) and [b] if the sender dies before it finishes a batch, I lose the chunks that the sender had queued up in the partially-stored batch. This is a datalogging application & I need to lose as little data as possible. (especially if the last bits of data would tell me something about the cause of the sender's death; the sender program may be getting this data from an unreliable program which could cause it to crash. yes I know programs shouldn't crash but sometimes they do, especially if they're not mine )
If I were to use a pipe (and I'm implementing both objects so they could, theoretically use out-of-band methods to talk to each other, though I'd rather not), the CPU overhead seems like it would go way down (admittedly, haven't tried it yet), and everything that the sender sticks into the pipe before it dies should eventually arrive at the receiver (even if the receiver takes a bit of time to get around to reading from the pipe).
Summary: I care about throughput, not latency, and the # of method calls through standard COM eats into my throughput too much, so I was hoping there would be a pipe for me to stuff bytes into. These are really bytes, they're not interface pointers or BSTR's or anything. (Or if they do mean something, they're handled at my application level.)
--Jason
|
|
|
|
|
In the scheme I described earlier using CoTaskMemAlloc you only send the address of the memory block and perhaps its size - Not 20 bytes. That said, if you want to use pipes the only real problem is getting the handles to the pipes to the sender and receiver. You could use CreapeNamesPipe and transmit the name of the pipe.
Steve
|
|
|
|