|
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
|
|
|
|
|
Hi all,
I have to implement a COM class with VB.NET. An object of this class has then to be created from a VB6 DLL. The code for the COM dll is very simple:
Public Class AdapterWrapper
Implements SchemaCompInterfaces.IEFAdapter
#Region "COM-GUIDs"
Public Const ClassId As String = "58faad86-bbac-4b20-9ab5-fe32bdac0a68"
Public Const InterfaceId As String = "f8dbb078-5f1e-4304-a390-3e8e88983f98"
Public Const EventsId As String = "113d2163-f8db-4d99-88e5-58d13b8d2cf4"
#End Region
Public Sub New()
MyBase.New()
End Sub
Public WriteOnly Property CurrentSPFProjectStatus() As SchemaCompInterfaces.SPFProjectStatus Implements SchemaCompInterfaces.IEFAdapter.CurrentSPFProjectStatus
Set(ByVal value As SchemaCompInterfaces.SPFProjectStatus)
End Set
End Property
Public Function DocumentExistsInTool(ByRef oDocumentIObj As SchemaCompInterfaces.IObject) As Boolean Implements SchemaCompInterfaces.IEFAdapter.DocumentExistsInTool
End Function
Following many more functions from the IEFAdapter interface...
The dll and tlb are created and registered.
The test code for the VB6 client to use this COM class is also very simple:
Private Sub Command1_Click()
Dim adapter As SchemaCompInterfaces.IEFAdapter
Set adapter = Interaction.CreateObject("MyEFAdapter.AdapterWrapper")
End Sub
Now when I'm running this code, I'm getting the Run-time error '13' Type mismatch in the CreateObject line. Late binding with
Dim adapter as Object seems to work for my test code, but is not a solution for me, because I can't change the proprietary VB6 code where the COM object is created. So somehow the interface "SchemaCompInterfaces.IEFAdapter" is not known...
Any ideas how to get close to this problem?
In the project properties I checked the flag for registration with COM-Interop. Perhaps something to do with the ClassInterface?
I'm relatively new to VB, so don't answer too complex...
Thanks in advance!
Alex
|
|
|
|
|
Hi
want to develop 64 bit application for 64 bit windows OS. I tried all VS2005 settings required to compile code in 64 bit. but when I install application , it get installed into C:\programme Files(x86) folder instead of C:\programme Files . Is it necessary to build code on 64 Bit OS.
Thanks
asas
|
|
|
|
|
You can build 64-bit applications on a 32-bit OS using Visual Studio 2005.
Visual Studio uses a 64-bit cross compiler to built 64-bit applications because Visual Studio is itself a 32-bit application.
When installing Visual Studio, this 64-bit cross compiler is not installed by default.
You have to customize the installation and manually select the x64 compiler for installation.
If you're not sure if you've installed the x64 compiler, run the Visual Studio installation again and do a modification to select this compiler.
After the compiler is installed, you can use it by selecting a new x64 configuration from Build -> Configuration Manager -> Active solution platform.
Please note that the target path is different for Win32 and x64 builds.
|
|
|
|
|
Hi
Thanks for your reply.
I did whatever settings required to compile/build 64 bit BHO application.
When i installed this application, it is not get registered with 64 Bit OS and hence no BHO installed on 64 Bit browser.
When i use 32 bit setting for compiling/ building BHO application, it gets perfectly installed. So what may be the reason of not registering BHO application for 64 bit IE browser.
Thanks
abm
|
|
|
|
|
How are you registering the BHO?
Are you using the 64-bit IE?
64-bit BHOs will only be loaded by the 64-bit IE and 32-bit BHOs will only be loaded by the 32-bit IE.
|
|
|
|