|
I do know how to debug from VB, but unfortunately it's not going to help here. It's a compile error, not a runtime error.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Seems very strange..if u mind to send me the source code I am ok to debug. otherwise try unregister/reregister or more safely try on another mechine. Because I had faced almost simialr prblm early. Initialy the DISP_ID was 1. After registration with 1, I changed it to 0 to set it as default. Again registred the component but, showed err in my mechine but worked fine in another mechine( with fresh registry entries).
best wishes..mil10
|
|
|
|
|
Thanks for the offer, but don't worry about it. I'll give it a go on a clean machine and see what happens. If that doesn't work, then i'll just leave it as is - the default property would be a nice extra to have, but it can still be used fine without it.
Thanks a lot for your help.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Because "Field" property gives an object (some interface like IField or IDispatch), the VB makes some additional action.
fld = "blah"
This always works because the VB cannot assign the string value to the object variable. He should call some method(property) for this. And this action is a calling of property-by-default (with dispid=0) if this property is presented by the object.
msg.Segment.Field = "blah"
This never works because the VB will call the "Field" property of msg.Segment object with parameter which equals to "blah". It gives the compilation error because probably the "Field" property does not have the parameters.
Try the following construction
msg.Segment.Field() = "blah"
With best wishes,
Vita
|
|
|
|
|
I am working in a framework in my COM server where I have a thread . From this thread I need to send events out of the Server which I am not able to do normally . What should I be doing in order to be able to send out events !
Related article in MSDN is
Events and threads
The good doctor alluded to problems he was having with events and threads earlier.
Here's the basic rule: Unless you do something special (more on this later), you always have to fire your events from the same thread that called IConnectionPoint::Advise. You may not normally start another thread and fire events from that thread. Why? Well, to fire an event means that you call into another object using an interface pointer.
But, in COM, you are never allowed to pass interface pointers between threads; you must marshall them instead. This is not terribly difficult to do, even though it involves calling the API with the world's longest name: CoMarshalInterThreadInterfaceInStream. (Perhaps it's named for a small town in Wales.)
You pass the stream pointer to the other thread (guaranteed to work in this special case) and call CoGetInterfaceAndReleaseStream in the new thread to get a marshalled interface pointer. Unfortunately, ATL's event firing implementation doesn't marshall the interface pointers, so it'll take some work to fire events from another thread.
In two common cases, this isn't an issue. If you're firing the event in response to a Windows message, such as a mouse button down message, you'll be okay. You'll be running on the same thread you were created on when you received the message.
Or, in our example, we fire an event in response to a method call. Again, this is safe, because the method will be called on the same thread you were created on.
It's only when you explicitly create a thread yourself (such as to sleep, or do some background processing) that firing events from the newly created thread becomes difficult.
So Do I have to Marshall the Interface to the COM server or all the IConnectionPoint Interfaces ?
|
|
|
|
|
CLSIDFromProgID returns CLSID successfuly but CoCreateInstance fails saying that that class is NOT registered?
|
|
|
|
|
CLSIDFromProgID and CoCreateInstance use the different branches of Registry.
Also, you can ask the other context for the object in CoCreateInstance. For example, CLSCTX_INPROC_SERVER for out-proc server (EXE server).
With best wishes,
Vita
|
|
|
|
|
Hmm. Ok. But I already call CoCreateInstance with CLSCTX_INPROC_SERVER to call out-proc server. How did you know? Are you saying that I should try different one?
Could there be something wrong with my out-proc server?
|
|
|
|
|
Try to use CLSCTX_LOCAL_SERVER instead.
With best wishes,
Vita
|
|
|
|
|
Hi,
I use OleCreateFromFile to create some ole bitmaps at the start of my program. This bitmaps are embeded in some richeditctrl's. The problem is the more bitmaps I have, the longer it takes for my program to load (because it reads the files from the disc).
I want to use OleCreatePictureIndirect which creates ole's from HBITMAPS that I can build from my resource bitmaps, reducing in this way the loading time. But I dont seem to get this function in vc7.0. Can you help me with this, please?
Thanks
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
Hi,
I intend to write a permanent MS Excel COM Add-In (dll) for experimental data analysis in VC++. Though, the registration in Win2k registry works fine, I can’t add the generated dll to Excel using Extras->COM Add-Ins->Add in the Excel menu. The file don’t occurs in the dialogs list view after click on the add-button from the open-dialog.
I’ve been trying to get a clue following the chapter “Building a minimal COM addin” from Amit Dey’s excellent article “Building an Office2K COM addin with VC++/ATL” as well as several other MSDN-articles, however without success. It works fine with Outlook2k but won’t with Excel2k. What’s my mistake? Any ideas?
Thanks in advance for any respond.
Mike
|
|
|
|
|
hi there
i wanted to know what is the variant data type (VT) for a LONG POINTER?
ie for long it is VT_I4 but what about a long *??
thanks
regards
|
|
|
|
|
You cannot pass pointers between COM-objects.
Cheers,
Fredrik
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
The variant, which contains the pointer to long value, has .vt==VT_BYREF|VT_I4 and .plVal==&long_variable.
long i = 77;
VARIANT vi;
vi.vt = VT_BYREF | VT_I4;
vi.plVal = &i;
With best wishes,
Vita
|
|
|
|
|
We got old COM component and it's used to retrieve ASP built-in objects. The COM component is using IScriptingContext interface. As per MSDN, it's an obsolete[^] interface and it suggest to use the IObjectContext interface.
Anybody know more about this. In meanwhile I will continue my search on MSDN.
I haven't worked with ASP objects so far and the guy who wrote left the company.
"...if you don't want to hear things that piss you off don't piss off other people. SIMPLE." - Steven Hicks This signature was created by "Code Project Quoter".
|
|
|
|
|
Hi,
Yes u r right. IScriptingContext interface - as per MSDN, it's an obsolete interface. But , still u can use it. Because it is working even in IIS6.0
U can also use IObjectContext if your component need com+ transaction support. Otherwise IScriptingContext is enough. (But use at ur risk . Because future versions of IIS may stop supporting IScriptingContext). U can use microsoft provided wrapper class Context.cpp and Context.h to get the ASP objects from IObjectContext.
best wishes...take care ..bi..mil10
|
|
|
|
|
Hi,
I am trying to generate a .h file from an idl file.
For this I am using Microsoft's MIDL Compiler.
I gave the following command:
midl myIDl.idl /h myidl.h
But when I run the command line exe, it gives me an error message saying:
midl : command line error MIDL1001 : cannot open input file oaidl.idl
can ne1 help
thanks
simon
|
|
|
|
|
Import oaidl.idl in the IDL interface file.
Kuphryn
|
|
|
|
|
You should provide the path where oaidl.idl is placed.
PS
You can include your IDL-file to any your Studio project (temporary) or make the small project for this.
And use Settings... for IDL-file to set necessary options. And compile it.
With best wishes,
Vita
|
|
|
|
|
Hi,
I have created COM EXE server and it has lot of structures in it. I have defined all the structures in IDL file. Now I am developing one method which passed the Structure data to client through structure pointer in the method. Only this method in not working. Other methods, which passes BSTR are working OK. What is the problem ?
Shall I need marshalling here? I gone through lot of material but I am not able to find sample code for marshalling. Can some body help me in this regard also ?
Regards,
MP
|
|
|
|
|
Create your proxies again using nmake.exe utility.. it shall work fine..
<hr>
Visit me:
http:
When you know something.. its meant to share with others :-) for otherwise that knowledge has no worth:-)
mail me:
aravinthan@rediffmail.com
<hr>
|
|
|
|
|
The easy way I found is to pass the data using IStream interface. At server side, allocate global memmory using CreateStreamOnHGlobal and copy the strcture to it.
Now you can read the allocated strcture from client.
MP
Visit my website
http://mandarbh.freeservers.com/
|
|
|
|
|
My program has been attached an ocx file from out-resources. When i try to invoke a method, SetServer (which simply calls SetProperty), provided by the ocx, it returns an error "this property is read-only". The similar thing occrs to GetServer(), which returns "this property is write-only".
The guy who provides the ocx claims her ocx works okay.
Any help is appreciated. Thanks in advance.
|
|
|
|
|
Hi all you gurus out there,
I've got a problem with an ActiveX control I wrote. Its a butotn that uses InternalGetText to display text on a button. When I embed the control in a VC6 app the initial caption displayed is correct, but when I chose to change the text again using the controls property page the caption reverts back to the original caption entered using the same property page. I can sucessfully change the caption programmatically using the controls SetCaption stock property later.
Any ideas why this is? Could it be a problem with the controls persistence data?
|
|
|
|
|
I developed an OLE mini server using VC++6. Everything works fine (both release and debug) as long as I insert the object manualy through the Insert Object dialog of MS Excel 2000. When I've tried to insert it from a VB AddIn for Excel it draws the frame but the interior of the rectangle remains transparent (the object is created but the container image of it isn't updated). It seems that when I insert from VB the OnGetExtent event it is not triggered (in the manualy case it is). How can I fix it? (I'll try to trigger the OnGetExtent through a method exposed by my object.) Here is a sample of how I try to insert the object from VB:
Dim obj as OLEObject
set obj = XLInstance.Sheets(ActiveSheet.Name).OLEObjects.Add (ClassType:="MyChart.Chart")
Thanx in advance...
|
|
|
|