I'm marshalling some data in a timerproc thread using the GetInterfaceFromGlobal and Release function. However I noticed there is a high cpu usage when calling this function multiple times. Any ideas why this is happening?
For each Release, I need to delete some COM+ Components for an Application and install some newer version of the same.
Till day it is accomplished through COM+ Window, I go to Component Services+Computers+COM+ Applications+'Application'+Components and select the components and delete them. Once deleted right click on components and select New->Component and then browse to the new version of dll which install back the components.
I tried to accomplish it through Regcomplus.exe. Issue is, it installs new components but it deletes all existing components under the application leaving just the new ones.
Command executed is "RegComPlus.exe <dll file> <application name>"
I have made a right-click drag-and-drop shell extension to copy specific project files. It's all working very well at copying files, but it freezes all instances of explorer.exe while it's doing its thing on bigger projects. A colleague told me to put sleep() somewhere in the copying function. I find this approach inelegant and possibly ineffective. There must be a way to make this more user- and thread-friendly. There was also talk of progress bars, but just one thing at a time...
Get IConnectionPointContainer interface of the application object, and get connection point to the events you want to catch. In this case, i think you have to deal with WorkBookEvents and DocEvents. Several documentations are available.. catching events from word
oh.. You did exactly as i guessed . xlRange is Range object's IDispatch iterface. If you haven't already done, add a Range class (say CRange) to the project from EXCEL.exe using 'Add MFC Class from Typelib' wizard. Then
See the methods on Range object now by using oRange. ----
well done OLE automation may need some R&D most time.
You can catch SheetCalculate event in much the same way you did for SheetChange event. Mean, all reside in IAppEvent interface, so Advice() for it, and override the SheetCaluclate method.
HRESULT _stdcall SheetCalculate(IDispatch* pSheetDisp)<br />
//let CWorkSheet is the wrapper of _WorkSheet<br />
CWorkSheet oSheet(pSeetDisp);<br />
//do whatever you want to do here.. :) <br />
I got it and do it , but facing one more problem as in case on "change event" I got the cell number i.e its row and column in which value is change . But "calculate event" fire when there is reference of another cell or cell containing formulae and when value change in such cell in this case I am not getting the cell no i.e cell row and column . this is my problem it become very tedious when I have the thousand of such cells having reference of various cells and formulaes. In this case I have to parse every cell to find out the value change . this become very slow for my project .I am searching the way to find out the cell row and column when there is calculate event fire .
Now I am facing one more problem . I have multiple excel file runnig on one system , but I am getting only one excel file using GetActiveObject. when I close this then I am getting second one using get object . so why I am not getting all the excel files ??
Checking the first 4 bytes of the location pointed to by the interface pointer returned by CoCreateInstance() function might give you the address of vtable (I have not tried it). But why do you want to do this?
I need to call all the functions of COM Interface exposed methods at runtime.
For this I need to access vtable of COM coclass where all addresses of exposed methods of its interfaces are stored.
Math is COM object
and its exposed interface is "Operations"
and "Sum" is the method of this interface.
I need the address of "Sum", so that I can call it on run time. Just like you use loadlibrary for DLL and adter passing functional address, using GetProcAddress we can call function at runtime.
Here in COM same I need to do. But here no LoadLibrary , and no GetProcAddress. Just we need to iterate vtable and one by one we'll get the addresses of methods and we'll call these methods on run time.