|
I'm using BO XI R2.
I want to modify the report.
Following is a code snippet which throws InvalidCastException;
and under that the Message is No Such Interfaces Supported.
Kindly suggest me a solution, if you have been able to crack it.
Also any ideas why such an exception.
using CrystalDecisions.CrystalReports.TemplateEngine;
using CrystalDecisions.ReportAppServer.ClientDoc;
using CrystalDecisions.ReportAppServer.ObjectFactory;
using CrystalDecisions.ReportAppServer.DataDefModel;
using CrystalDecisions.ReportAppServer.Controllers;
using CrystalDecisions.ReportAppServer.CommonObjectModel;
using CrystalDecisions.ReportAppServer.ReportDefModel;
ReportClientDocument reportClientDocument = new ReportClientDocument();
SessionMgr sessionMgr = new SessionMgr();
EnterpriseSession enterpriseSession;
EnterpriseService enterpriseService;
InfoStore infoStore;
InfoObjects infoObjects;
InfoObject infoObject;
ReportAppFactory reportAppFactory;
string sampleReportName;
enterpriseSession = sessionMgr.Logon("administrator","","localhost","secEnterprise");
enterpriseService = enterpriseSession.GetService("InfoStore");
infoStore = new InfoStore(enterpriseService);
sampleReportName = "World Sales Report";
infoObjects = infoStore.Query("Select SI_ID From CI_INFOOBJECTS Where SI_NAME='" + sampleReportName + "' And SI_INSTANCE=0");
infoObject = infoObjects[1];
reportAppFactory = (ReportAppFactory)enterpriseSession.GetService("","RASReportFactory").Interface;
reportClientDocument = reportAppFactory.OpenDocument(infoObject.ID,0);
reportClientDocument = reportAppFactory.OpenDocument(infoObject.ID,0);
code segment throws the Exception
modified on Tuesday, September 7, 2010 2:18 AM
|
|
|
|
|
Please do not post the same question in more than one forum.
It's time for a new signature.
|
|
|
|
|
I'm developing a COM object in a dll. The object takes an IUnknown** parameter.
interface IPasser : IDispatch{
[id(1), helpstring("method Pass")]
HRESULT Pass([in]IUnknown* ptr);};
When using it in-process I can send NULL as parameter, but when I instantiate the com object usign a surrogage usign CLSCTX_LOCAL_SERVER I get an error message 0x800706f4, "A null reference pointer was passed to the stub."
IPasserPtr obj;
IUnknown* ptr;hr = obj.CreateInstance (CLSID_Passer, 0, CLSCTX_LOCAL_SERVER);
hr = obj->raw_Pass (0);
hr = obj->raw_Pass (&ptr);
This is only a problem when I use double indirection, not when I use an ordinary IUnknown*.
Can anyone tell me why this is not allowed and how to change the implementation to be able to send a NULL pointer.
/Per
|
|
|
|
|
You said it yourself - the raw method expects a pointer to a pointer - that's why passing a NULL results in an invalid argument error code. You need to pass a pointer to a null for this to work (you actually have the solution in your question).
|
|
|
|
|
Thanks for the response.
To clarify a bit. The parameter is used to return a COM pointer.
If the caller don't need the value, it sends NULL.
So my implementation has the following construction
if (ptr != 0) {
*ptr = something;
*ptr->AddRef ();
}
This i not uncommon in C++ programming, but for some resaon its problematic in COM.
|
|
|
|
|
I think this[^] might be the answer you need. Apparently the COM object going out of proc causes a problem if the pointer is null. Try declaring the pointer as unique - read more in the article I linked to.
modified on Friday, September 3, 2010 3:29 AM
|
|
|
|
|
Thanks for a very interesting link.
Though, I was not able to reproduce the behavior, even with the code in the article.
Even if I put, unique or ptr as attribute to my parameter ([in, string, unique] ) I get the same error code.
I can pass a IUnknow* with 0 as value, both with unique and ref (which should be impossible), but a wchar_t* cannot be passed, regardless of the unique attribute or not.
/Per
|
|
|
|
|
Hi,
Does any one know when is this "WSACancelBlockingCall" called.
I am facing a very strange problem with this. We have a editor to write our scripts, one of the script captures a window rectangle and send it to a COM api to get the text from the image. We use FineReader as the OCR tool which is on a different server.
The problem is when we run the script through the editor it returns the correct result. However we have another script which can run the scripts in batch files, when run through this, the socket to the sever returns "WSACancelBlockingCall"
Following is the code:
CSocket RecvSockSrv;
RecvSockSrv.Create(nPort);
RecvSockSrv.Listen();
CSocket RecvSock;
//**************************************************************************************
SocketData data;
data.socket=&RecvSockSrv;
data.event = CreateEvent(NULL,FALSE,FALSE,NULL);
if (data.event==NULL)
{
// Error
}
data.nTimeOut = 15000; // Set TimeOut to 15 seconds
DWORD threadID;
HANDLE threadHandle = CreateThread(NULL,0,&ThreadFunc,&data,0,&threadID);
if (threadHandle==NULL)
{
// error during thread creation
}
int returnVal;
returnVal = RecvSockSrv.Accept(RecvSock); // Returns non zero when run through editor and 0 when the script is used.
Can anyone pls help me with this.. I want to know under wht circumstances the call is blocked with "WSACancelBlockingCall".
Thanks in advance for any help
|
|
|
|
|
I have a COM dll, the dll expose a method BOOL Open(const wchar_t* filename, OUT std::vector<MyStruct>& dataout);
The function 'Open' take the parameter filename, to open the file, and construct the data from the file to pass it out to outside world.
But of course the client crash in runtime because the CRT problem, I googled and the link give me answer, http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/83a026d8-09b1-4d57-8c4a-ab2d139624b4[^]
So if I don't want pass STL vector as out parameter, then How can I design my COM dll to deal with such situation(open read the file and pass out the data)?
modified on Tuesday, August 24, 2010 2:02 AM
|
|
|
|
|
You can check if a safe array helps instead of vector.
|
|
|
|
|
Hello,
I'm new to Ole Programming.
I'm calling this method on an IOleObject because I want to insert a copy of this object into the very same IRichEditOle where I took it from.
hr = reObject.poleobj->GetClipboardData(0, &dataObject);
hr is OLE_E_NOTRUNNING after this call ("Need to run the object to perform this operation.")
reObject is a REOBJECT structure that I get from iterating through the objects the Rich Edit contains (three images).
Does anyone know what the issue is and how I can solve it?
Thanks and best regards,
Gabriel
|
|
|
|
|
I am having trouble with some objects. I'm getting access violations when trying to use some of the methods in the object, which I think is due to not initializing the object when I create it..but there's the problem, I can't use the new operator to create it because it complains about virtual functions. Here's the different ways I've tried to initialize it
1:
IDgnWords words = new IDgnWords() ;
Errors (some of them anyway):
error C2259: 'IDgnWords' : cannot instantiate abstract class due to following members:
warning C4259: 'unsigned long __stdcall IUnknown::AddRef(void)' : pure virtual function was not defined
2:
IDgnWords* words ;
words->Dump( CComBSTR("C:\\words.txt") ) ;
Error: Access Violation when reaching the Dump function
3:
CComPtr<IDgnWords> words ;
words->Dump( CComBSTR("C:\\words.txt") ) ;
Error: Run Time error. No message box pops up, but I can't step any further in the code while debugging.
The class has no initialize functions so and I think this is where I'm having trouble. Is there something I should be doing to initialize the objects?
|
|
|
|
|
The most significant information is done by your first attempt:
- error
C2259 : cannot instantiate abstract class due to following members: unsigned long __stdcall IUnknown::AddRef(void)
As the compiler said, you cannot instantiate this class in any way, because it misses something; if you write the code of that class the solution is obvious: implement unsigned long __stdcall IDgnWords::AddRef(void) and this will fix you problem - by writing
IDgnWords* words; you have allocated only a pointer to that class, but you should initialize it with new IDgnWords() before use it. If you don't do it, the pointer hold a random address and trying to use it generates a memory protection faultCComPtr<IDgnWords> words; declares a smart-pointer to the IDgnWords class, then all that I said about IDgnWords* words; is still valid, and this is the reason of your crash. CComPtr simply wraps a IDgnWords* and calls the Release() method for you when the variable goes out of scope
|
|
|
|
|
As for attempt 1, I didn't write the code for the class (it's from Nuance Dragon Naturally Speaking SDK).
For attempt 2, I get the same errors when doing:
IDgnWords* words = new IDgnWords() ; (ie. cannot instantiate abstract class)
|
|
|
|
|
Now one thing that isn't making sense is I used a different class from this SDK and I was able to call
CoCreateInstance( CLSID_DgnVocTools, NULL, CLSCTX_ALL, IID_IDgnVocTools, (LPVOID*)&pIDgnVocTools ) ;
I would think that I would need to create and instance of the IDgnWords object, but there's no CLSID for it. If I don't create and instance of that VocTools object I used in the previous paragraph, it craps out on me just like the IDgnWords object is doing now.
You think this could be the problem? It seems odd to me that creating a "new" object doesn't seem to work for this.
|
|
|
|
|
I thought that IDgnWords was a class that you wrote because COM classes should be created trough their class factory using the CoCreateInstance() function, or queried to another class that you have already instantiated using the QueryInterface() method.
If there isn't a CLSID_ trough that you can instantiate the IDgnWords , probably you should first instantiate another class and then query it for the one you need...
I tried searching the internet for documentation about IDgnWords , but I didn't find anything. Dragon Naturally Speaking is a payed product: have you got any documentation from Nuance? Have they give you any technical contact to ask for?
I'm sorry, but I don't know what else to tell you
|
|
|
|
|
hi
i have an excel add in application. when i try to install the application on target machine.the add in failed to add.
when i check the add in in excel my add in there but shows in inactive add in application. when i try to add the com in .. its shows me a runtime error occured during the loadin of com add in ... how can i resolve it.
|
|
|
|
|
Hi,
I need to call a function written in C# from the unmanaged code.
The code from where I have to call the function is purely written in VC++ and it come in the unmaged part of the solution code.
Most of the solution is written in C# .NET 3.5.
Please help me out.
Thanks In Advance
Abbas
|
|
|
|
|
|
Hi
I am using CWindowImpl::create() API which internally call CreateWindowEx() method.
When I test this API of win32 OS. It works fine, but when I test on 64 Bit OS above API failed
|
|
|
|
|
|
GetLastError() value is 1413
|
|
|
|
|
application get crash in CreateWindowEx() function on 64 Bit Windows XP.
Is there any setting required to work CreatewindowsEx() function in 64 Bit windows.
|
|
|
|
|
am 2009 wrote: Is there any setting required to work CreatewindowsEx() function in 64 Bit windows.
No it works the same. The error code you recieved would imply that something may be wrong with the WNDCLASS Structure[^]. Make sure that you are initializing it to zero:
WNDCLASS yourclass = {0};
The error code may also be caused by using a 32 bit DWORD parameter rather than a DWORD_PTR.
Rules for Using Pointers[^]
Best Wishes,
-David Delaune
|
|
|
|
|
how to set a file name in coleinsertdialog class without opening its dialog. I do not want to call its DoModal function which select a file
COleInsertDialog dlg;
dlg.somefunction = "c:/myfile"
//do not call domodal to to select a file
|
|
|
|