|
I want to create a smart tag application using the Word Document project in .Net 2.0. The problem I should be able to show the smart tag when the user types on the word doc.
Any help would be appreciated
|
|
|
|
|
Hi,
I'm experiencing and issue regarding System.AccessViolationException : Attempted to read or write protected memory that occurs since Vista. On XP's or previous, everything run fine. To be more specific. I have a C++ ATL/COM object (created in VS 6) that is wrapped in C# .NET 2.0 . Problem occurs when handling Strings.
I've created COM using standard tools in VS 6.
this is the method definition from Interface IDL file :
[id(9), helpstring("method GetString")] HRESULT GetString([out] LPSTR* word, [out, retval] int* count);
Inferface .h Header file :
STDMETHOD(GetString)( LPSTR* word, int* count);
Code Inferface.c file :
STDMETHODIMP CLicenser::GetString(LPSTR* word, int *count)
{
*count = this->helperClass.GetCount();
*word = this->helperClass.GetWord();
cout << "word:" << *word << endl;
return S_OK;
}
Method definition in C# wrapper looks like:
int IClassNameObject.GetString(out string);
Anytime this method is called, it finishes properly (also including that Console output word:[whatever word contains]), besides in Vista, it throws that System.AccessViolationException with name of that (GetString) method after it finishes.
Method is Supposed to return a count and fill a supplied string.
If u need I can create sample project / dll , I don't have one now....
zilo
|
|
|
|
|
From your description, it looks like the problem is with the helperClass member. How does that work?
Nathan
|
|
|
|
|
If not used in any other projects I would strongly recommend that you stick to Automation-compatible types, so here you would use a BSTR rather than LPSTR. .NET understands Automation types better than raw types.
If you can't do this, you need to ensure that the marshalling and memory model are followed correctly. You need to tell MIDL that the parameter is actually a null-terminated string (use the string attribute in addition to out ) so that the data is marshalled correctly. Otherwise it assumes that the LPSTR points to a single char .
For returning a string, you must return a new buffer allocated with the system allocator, CoTaskMemAlloc . I suspect what's happening is that .NET is trying to free the returned pointer by calling CoTaskMemFree and in Windows XP, you were getting away with it.
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
Hi,
I wasn't able to replace LPSTR with BSTR. My knowledge about C++ is limited and I did not find corresponding conversion.
Anyway, I added string attribute and started using CoTaskMemAlloc on C++ side and so far it's working under Vista too, so thank you very much!
zilo
|
|
|
|
|
I am trying to send an array from my C# app to an ActiveX component. The array consists of floats and I have used the following declaration:
DISP_FUNCTION(MyCtrl, "SetArrayFunc", SetArrayFunc, VT_EMPTY, VTS_PR4 VTS_I2)
where SetArrayFunc looks like this:
void MyCtrl::SetArrayFunc(float *NewBuffer, short Length)
In my C# app i try the following:
ThisCtrl.SetArrayFunc(ref MyBuffer[0], (short) MyBuffer.Length);
Where of course MyBuffer is an array of floats.
However it seems as though only the first element of the array is transferred.
I have also tried using VTS_VARIANT but that did not work either.
Is there anyone here who has an idea how to solve this?
|
|
|
|
|
I would change SetArrayFunc to take an OLE SAFEARRAY. Then you should be able to pass the array directly.
Nathan
|
|
|
|
|
I'm not sure how to do that, simply replacing VTS_PR4 with SAFEARRAY gives me the following error:
"error C2275: 'SAFEARRAY' : illegal use of this type as an expression", so I guess that was not how you meant?
|
|
|
|
|
Hampus@foi wrote: I'm not sure how to do that, simply replacing VTS_PR4 with SAFEARRAY gives me the following error:
"error C2275: 'SAFEARRAY' : illegal use of this type as an expression", so I guess that was not how you meant?
SAFEARRAYs are fairly complicated. You'll need to read a bit of documentation on how to use them. If you don't have the info on your own computer, I think you can look it up on msdn.microsoft.com.
Nathan
|
|
|
|
|
Create safe array of variants where variant elements will contain the floats. Let me know if this helps.
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Hi Everybody,
I have been trying to save a powerpoint slide from a win32 sdk application.
My Requirment is like this, From my application i need to open a powerpoint application using ole and then save the slides as bitmap .But this is not possible for me to use any mfc based application or active x control.
Can anybody please help me out in this case
Thanks in advance
Niloy
|
|
|
|
|
Hi,
I want to create a phone number control. It has text boxes for a USPhone number, an international phone number and international country code. I want it to display the USPhone field and d so in a formatted manner. If the record's Country is blank or "US" or "Canada"...
I think I can create the control. Will I be able to import it into Access and use it on a form that is bound to a table, such that I can bind this control to several fields in the table?
Thanks!
Chuck
|
|
|
|
|
Hi,
I am trying to use the Visual SourceSafe 2005 SSAPI.DLL in a simple Windows application (C++), but I can't get around an error that indicates that the classes of the DLL are not registered. I have manually registered the DLL using the REGSVR32 utility, but I still get the error.
Any help greatly appreciated.
|
|
|
|
|
Is Visual Source safe registered on your machine? If this is the case then, it is possible the construction of CoClass fails resulting CoCreateInstance returning Class not registered error.
See - http://support.microsoft.com/kb/201431
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
I'm missing the OLE Container control from VB6 so ny question is
Is it possible to build a Com component which acts as an OLE container control for one specific COM EXE server?
It should provide a window for InPlaceActivation of the specific server, for example Microsoft Equation Editor.
Thankx in advance
Lennart
LLINF
|
|
|
|
|
Once I click the receive button twice, accidentally, the NULL modem program running between two PCs is hung !!
How can I detect the data is received so that I can read the data without hanging the COM program written in C# Visual Studio .Net.
Any one can help.
Thank you
yak
|
|
|
|
|
I have a COM collection object that maintains two STL containers. While it is unlikely, it is possible that an exception will be thrown while the containers are out of sync. In a normal application, I would simply abort under those conditions. What should an in process COM server do if such a fatal error occurs?
Nathan
|
|
|
|
|
Nathan,
Usually, Exceptions in COM server shouldn't bubble up. Since it's an inproc server, aborting would terminate your client application. I don't know any solution that I have implemented but does any of the following help you device a framework -
1. Supporting ISupportErrorInfo for rich error information and your methods could fail with some HRESULT. Client is expected to take necessary action.
2. Not a good one, but if these are internal error and assuming there is no method call in progress, you could implement an event handler and notify client of this exception.
Just back from work so can't think of any more solutions
Let me know if this helps.
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Thanks! That's about what I thought. From what I've read, E_UNEXPECTED is intended for that sort of thing.
Nathan
|
|
|
|
|
Yes. by HRESULT I meant E_UNEXPECTED in this case, but you may want to specialize this error code if required.
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Hello all
I'm trying to use activeX to write a web interface for my application.
Does anyone know where to start to learn how to write activeX controls using C/C++ without ATL or MFC but accessing it from scratch.
Or can anyone recommend any good books?
thx
Bmbsage
|
|
|
|
|
Ask to Jeff Glatt [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I just want to make a software that needs some calculations and waveform plot in matlab 7...
I have written the required .m files and using the combuilder of matlab 7 to generate the com files to be used in VB .Net. but after compilation in VB .Net the generated stand alone exe file still needs the MATLAB RUNTIME LIBRARY. Is there any possible way to make it independent of The MATLAB And its Run time library....
if I compile the .m file to generate .exe file using matlab... then also the dependency remains...
plz tell me how this can be solved.....
Thank You.......
@rish
|
|
|
|
|
You cant because the way COM operates. The matlab Client (COM VB Object) will allways referenciate to a Matlab Server. Maybe you can connect to a Matlab Server in another Machine but you will always depend on the runtime libraries because the server needs them.
JO
|
|
|
|
|
Hey everyone!
I'm not sure if this is the right place, but I'm having some issues trying to debug a managed application invoking a COM server.
When I attach the native debugger, the modules window of visual studio tells me that there are no symbols loaded for my interop assembly (Interop.xxx.dll). It fails to load xxx.pdb, which I can understand. However, I have no idea how I have to generate the symbols. I've tried looking in the usage of tlbimp, but no such luck.
Any pointers on this?
|
|
|
|