|
how did u try it? please show a bit of code..
|
|
|
|
|
STDMETHODIMP CAppEventListener::HandleSheetChange( IDispatch* xlSheet,
IDispatch* xlRange)
{
OutputDebugString("HandleSheetChange\n");
xlRange-> here not gettting text method
HRESULT hr = S_OK;
return hr;
}
Trioum
|
|
|
|
|
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
CRange oRange(xlRange);
See the methods on Range object now by using oRange. ---- 
|
|
|
|
|
Done it . but exe is crashing as I call getText()
Trioum
|
|
|
|
|
Now by lot of R&D problem is solved . Can you guide me for SheetCalculate event . its example is not given on the site.
Trioum
|
|
|
|
|
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.
<br />
HRESULT _stdcall SheetCalculate(IDispatch* pSheetDisp)<br />
{<br />
CWorkSheet oSheet(pSeetDisp);<br />
}<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 .
Trioum
|
|
|
|
|
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 ??
Trioum
|
|
|
|
|
Hello, I'm trying to add text-to-speech support to my emulator, this was simple to do on the Amiga version but is causing lots of headaches under Windows.
I'm linking with the sapi.lib from the official Speech SDK 5.1, everything is compiling fine but I'm getting these linker errors:
ibm1.obj : error LNK2001: unresolved external symbol _IID_IVTxtNotifySinkA
ibm1.obj : error LNK2001: unresolved external symbol _CLSID_VTxt
ibm1.obj : error LNK2001: unresolved external symbol _IID_IVoiceTextA
Aren't these supposed to be defined in sapi.lib? So why am I still getting linker errors? I'm using Visual C 5.0 and WinXP SP2. Thanks.
|
|
|
|
|
|
Hello,
How to iterate (infact access) the vtable of COM coclass(that will implement the methods of its exposed interfaces).?
Only I need to access vtable where all addresses of exposed methods of its interfaces are stored.
e.g Say
Math is COM object
and its exposed interface is "Operations"
and "Sum" is the method of this interface.
I need the address of "Sum"
Regards
Muhammad Usman Khalil
|
|
|
|
|
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.
e.g Say
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.
Any Suggestions?
|
|
|
|
|
Take a look at this article[^] which explains the basics of the COM vtable and pointers, it should help you understand how to get what you want. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
|
Even if you get the function pointers this way, how to get the function signature (arguments and types)? You may have to use type library to get more details about the interface functions and supported interfaces.
|
|
|
|
|
a coclass will always have pointers to virtual tables (of all interfaces it implements) as its instance data. In CreateObject() function, coclass is instantiated, type casted to the interface ptr which we demands through CoCreaInstance and returned. so the returned ptr will be pointing to the virtual table of that interface. This virtual table ptr is used later in function calls to locate the correct implemented functions. Pls correct me if iam wrong..
|
|
|
|
|
Can we then be able to take its size as well?
I mean how many no of entries(addresses) that vtable would then have?
|
|
|
|
|
size of the returned interface ptr will be size of a pointer (4 bytes as any pointer). so in order to call the functions using that ptr, u need to have their declarations. Also for all com interfaces, first few entries in vtable will point to the implementation of functions from the base interfaces, such as QueryInterface, AddRef ... of IUnknown. So think whether ur plan is going to work our or not..
|
|
|
|
|
Here is a link to very extensive work & code concerning this, that is, dumping VTables and VPtrs...
http://www.jose.it-berater.org/smfforum/index.php?board=362.0
|
|
|
|
|
You're going about things the wrong way. Getting the v-table's address is no problem. Doing something useful with it will be. All it is an array of function pointers. The pointers have no type information associated with them. It sounds like you should look into type libraries (see the ITypeLib[^] interface) or automation[^]. Steve
|
|
|
|
|
I have got the addresses of functions from vtable but in little wiered manner.
like typedef void (*FN)(void)
FN pFn=0
int* dwPtr= (int*)pSomeInterface;
pFn=(FN)*((int*)*(&dwPtr[Count])+1);//will give the address of QueryInterface
pFn=(FN)*((int*)*(&dwPtr[Count])+2);//will give the address of AddRef
pFn=(FN)*((int*)*(&dwPtr[Count])+3);say release
pFn=(FN)*((int*)*(&dwPtr[Count])+6);//and finally my method Sum
but this is all hardcoded stuff and little wiered.
I in a search of some generic usefull method to lookup their addresses and then I NEED their NAME as well so that which ever at runtime I give the name as function my app should traverse and call only that method
|
|
|
|
|
typedef void (*FN)(void)
using FN, how are you going to call those methods like QueryInterface, AddRef.. as they take various number of arguments? u may be able to call without errors, bt result will be unexpected. without having specific info about the functions in interface, u won't be able to proceed..
|
|
|
|
|
Yeah true.!!
but _asm patch helped me out in this regard.
_asm
{
push argument_1
push argument_2
call proc ;function address
}
Here suppose i have given all info (parameters or arguments) at run time for NOW(Which I have passed it on runtime console).
For future(might be later) I will load every thing from TLB's. e.g (How to know that QueryInterface taking 3 params of different type? This is ITypeLibe which provides information from TLB of that Component which I can query from registry to load specific TLB and give me specific function signature and types).
Hence I got all params and function names as well(Which I can decipher from signature working with RE's(regular expression)).
But Now I need to call the function, which would have specific address(NOT KNOWN) arguments(parameters) which I have collected from TLB, and name as well. How that address corresponds to that function name to which I am going to call.
For this I need to traverse vtable which is holding functional addresses, LASTLY need to correspond function address with NAME of that function. This is I dont know. How? More over one function with the same name may appear in vtable(Overloading case). In that case we need to distinguish function names w.r.t their addresses. How to tackle ?
|
|
|
|
|
I have some code in Visual Prolog compiled into a DLL.
I am hoping to build a GUI using C# that would interact with the DLL.
Visual Prolog supports COM.
Is COM the way to make my C# GUI interact with the Prolog DLL, or are there other ways?
|
|
|
|