|
Hello David,
Just curious about one thing, in your "for" loop :
for (int i = 0; i < pNum_ROI_nodes * 2; i++)
{
pfCoordValue[i] = (float)pROI_coords[i]; //retrieve the values to local array
}
why do you loop until "pNum_ROI_nodes * 2" ?
The returned "pROI_coords" should contain only "pNum_ROI_nodes" number of values right ?
Regards,
Bio.
|
|
|
|
|
The array contains the x and y coordinates of each of the nodes that have been found and therefore is two times the number of nodes. They are just packed in sequential pairs.
BTW, this method that I am trying to get going is from a text "Com+ Programming" by Pradeep Tapadiya. It just seems as though this might work if I have the proper settings??? I have seen it on MSDN and other postings as well.
Do you understand what Vita was talking about with a Proxy/Stub DLL and why wouldn't the TypeLib marshaller understand the size_is ?
Thanks,
David
|
|
|
|
|
Hello David,
>> The array contains the x and y coordinates of each of the nodes that have been found and therefore is two times the number of nodes. They are just packed in sequential pairs.
I see. However, would I be right in asserting the following :
1. The array is one dimensional nevertheless, as far as COM is concerned.
2. The fact that you have packed pairs of values in the array is a high-level design point.
If I'm correct about the above two points, then take note that "pNum_ROI_nodes" needs to be set to the actual number of elements in the array (which, from a high-level standpoint, would be "two times the number of nodes"). It should not return the "total number of nodes divided by two" - this is a high-level design issue and will not be understood by COM.
The "for" loop in your client code may need to be modified in view of the fact that the logic behind the value of "pNum_ROI_nodes" is now different.
>> Do you understand what Vita was talking about with a Proxy/Stub DLL and why wouldn't the TypeLib marshaller understand the size_is ?
Yes, David. Due to the fact that you are using a non-OLE-automation-compatible array (OLE-automation-compatible arrays would require the use of SAFEARRAYs, the size_is attribute is not relevant here), a Proxy/Stub DLL is required so that the marshaller knows how to properly handle your method and your array (between the server and the client).
The TypeLib marshaller is used when your interface is based on IDispatch and all parameters are based on automation-compatible types.
If you are using VC++ 7.0 (i.e. from Visual Studio .NET), a proxy/stub DLL project is generated automatically for you by the wizard, but you would need to make sure you fully build it. Once it is built, the wizard will register it. Once it is registered, the marshaller will know where to locate it and use it during client run time.
If you are using VC++ 6.0, you would need to build the proxy/stub project and dll manually.
Best Regards,
Bio.
|
|
|
|
|
Thanks for your answers Bio.
I am using VC++6.0 so I have to build it manually. I have tried to run the nmake command from a command prompt at the top of the project .cpp file...
// Note: Proxy/Stub Information
// To build a separate proxy/stub DLL,
// run nmake -f SPDComps.mk in the project directory.
This is the error that I got.
fatal error C1189: You need a Windows2000 or later to run this stub because it uses the following features: NMAKE: error U1077: 'cl' return code '0x2'. Stop.
Lim Bio Liong wrote:
If you are using VC++ 6.0, you would need to build the proxy/stub project and dll manually.
I can also use SAFEARRAY's but I didn't have much better luck using them. I didn't seem to get anything back then. I may try that also. Maybe I have learned something more in the last few days of trying this...
David
|
|
|
|
|
Hello David,
You are most welcome, David. Did you manage to resolve the issue ?
>> I am using VC++6.0 so I have to build it manually. I have tried to run the nmake command from a command prompt at the top of the project .cpp file...
It might be easier to build a proxy/stub DLL project within the Visual C++ IDE itself. It isn't very difficult. I'll try to come up with a sample for you soonest possible (give me a short while to get this organized).
>> I can also use SAFEARRAY's but I didn't have much better luck using them.
You'd need to learn several COM APIs that pertain to SafeArrays. It may take a while but may be worth it if one day you may have VB clients or clients that run as scripts.
Will get back to you soonest possible. Meantime, pls send me a test email so that I can reply a post with some sample codes when it's ready. My email is :
bio_lim_2004@yahoo.com
Best Regards,
Bio.
|
|
|
|
|
Hello David,
This is a long shot, David, but I believe that your proxy/stub dll is probably already built and registered. Otherwise, once you call the method (which returns the array), an error would occur.
It could still be that the proxy/stub dll needs to be updated (following some changes to the IDL).
Just a guess.
- Bio.
|
|
|
|
|
Please tell me how can I stop my axWebBrowser to stop download all non-text files(media,wav,image...) embeded in HTML page.
I want to download only html text.
Please provide me mshtml COM programming solution only in C# code.
love2code
|
|
|
|
|
Hi i have added a new interface to an existing component.but when i tried to access the interface in the client program it is saying "access to QueryInterface failed". In this i have two interface both are derived from IDispatch. In COM_INTERFACE_ENTRY i have a ambigiuty error..i solved it with COM_INTERFACE_ENTRY2 macro. Is this have any effect onthe previous error..
Thanks in Advance
|
|
|
|
|
Which interface showed error. first one or second one? and how did u call. thru IDispatch or queryinterface?
COM_INTERFACE_ENTRY2 has impact on the calling mechanism, if u have more than IDispatch interfaces in a single CoClass. U can't invoke the second interface bu using IDspatch Invoke mthd. You have to use QueryInterface for that . Only the first Interface can have IDispatch Invokation.
rgds...mil10
|
|
|
|
|
Hello people,
I am new to programing in vb.net or c#.net. So please be gentle with me!
I added a reference to a com in a c# project with some strange results. I added a reference to the same com in vb.net and had no problems.
The interface i have a problem with is shown below. (Taken from the object browser)
vb.net it appears as:
item([byval as object],[byval as object]) as FRRobot.FRCIOType
Public Overridable ReadOnly Default Property Item(Optional ByVal Type As Object = Nothing, Optional ByVal Index As Object = Nothing) As FRRobot.FRCIOType
Member of: FRRobot.IIOTypes
c#.net it appears as:
this[object,object]
public const abstract new FRRobot.FRCIOType this [ get]
Member of FRRobot.IIOTypes
Can anybody please help me?
Ned
|
|
|
|
|
Hi,
I automate PowerPoint using VC++.
I want to group some shapes of a slide.
To do this, I have to use the method Range of the object Slides.
Its prototype is:
LPDISPATCH Range(const VARIANT& index);
I don't know how constructing the parameter.
I've tried something like this, with no success:
------------
int index[2];
index[0] = 4;
index[1] = 5;
VARIANT var;
VariantInit(&var);
var.vt = VT_ARRAY;
var.pintVal = index;
shapeRange = shapes.Range( var);
---------
This is the beginning of my code:
-----
_Application app;
Presentations presentations;
_Presentation presentation;
Slides slides;
_Slide slide;
app.CreateDispatch("Powerpoint.Application"))
Presentations presSet(app.GetPresentations());
_Presentation pres(presSet.Add( true));
Slides slideSet(pres.GetSlides());
_Slide slide1(slideSet.Add(1, 2));
-----
Thanks
|
|
|
|
|
Hello Nithya..,
Simply add the following line to the coclass declaration :
interface Ibbb;
as in :
//idf file
coclass aaa
{
[default] interface Iaaa;
interface Ibbb;
};
make sure that Ibbb is either defined in the same IDL or the IDL that contains the definition of Ibbb is imported into your IDL.
After this is done, if you are using ATL, use the ATL wizard to "implement interface" the Ibbb interface.
Best Regards,
Bo.
|
|
|
|
|
Helllo
I am using a datagrid in a web application(.NET). When an user clicks the grid I want an menu to appear, (something like windows right click). I was thinking of creating the menu and all the functionallity in VB 6.0 ActiveX, and importing the ocx into the web app and using it there...
Will this work?
Is there an better way to solwe this problem?
Spaz
|
|
|
|
|
I have an In-Proc server that needs a service by a client exe. So, I added an interface to the now "Out-of-Proc" client exe for the now 'client' In-Proc. Everything compiles except during run-time, I am getting the following error: "0x80010105: The server threw an exception." when the new interface is accessed. I am not sure if this can be done this way. Anyone have any ideas?
|
|
|
|
|
Hi,
I've just successfully implemented my first ever automation client. It works well, however, I have this problem that if my app dies abnormally, or I press the debug stop button, my app is gone leaving the server process still running, unreleased, hogging 80Mb of RAM. Is there a good way to make it so that if the client dies, the server app will automatically follow suit?
Joel Holdsworth
|
|
|
|
|
Hi,
I need to do a web based client-side application, and ActiveX was the unique solution I've found to track client requirements. But this application needs a toolbar and 3 splitted windows with different controls inside and I started ActiveX search last friday.
I've tried CWnd::Create when OnCreate of the COleControl, and after the crash, I tried to add a toolbar in the Control, but nothing worked. Only if I do something in OnDraw I can see something when I test that.
I've seen some controls made with MFC but none of them seems to have windows or toolbars, they're all dialog based. Is possible to do that thing? or is there a better way.
I don't know where to go from here. Do you know any samples or books?
Thanks in advance
|
|
|
|
|
Hi!
I'm just starting COM,and have to submit a project this semester... advanced networking and COM. we are a team of four... Can anyone suggest a good topic for the project... one such that i can show it on my resume... thanks!
|
|
|
|
|
Hi,
I really need your help. I'm trying to call the Render method in IPictureDisp, but I seem to be messing up my array of VARIANTs. Because every time I execute the code it gives me HRESULT 0x80020005: Type mismatch. I can't see what I'm doing wrong though:
arguments[9].vt = VT_HANDLE;
arguments[9].lVal = (LONG)dc;
arguments[8].vt = VT_I4;
arguments[8].lVal = destrect.left;
arguments[7].vt = VT_I4;
arguments[7].lVal = destrect.top;
arguments[6].vt = VT_I4;
arguments[6].lVal = destrect.right - destrect.left;
arguments[5].vt = VT_I4;
arguments[5].lVal = destrect.bottom - destrect.top;
arguments[4].vt = VT_I4;
arguments[4].lVal = 1;
arguments[3].vt = VT_I4;
arguments[3].lVal = 1;
arguments[2].vt = VT_I4;
arguments[2].lVal = MulDiv(destrect.right - destrect.left, HIMETRIC_INCH, ::GetDeviceCaps(dc, LOGPIXELSX));
arguments[1].vt = VT_I4;
arguments[1].lVal = MulDiv(destrect.bottom - destrect.top, HIMETRIC_INCH, ::GetDeviceCaps(dc, LOGPIXELSY));
arguments[0].vt = VT_BYREF;
arguments[0].byref = &destrect;
dispparams.rgvarg = arguments;
dispparams.rgdispidNamedArgs = NULL;
dispparams.cArgs = 10;
dispparams.cNamedArgs = 0;
result = picture->Invoke(DISPID_PICT_RENDER, IID_NULL, 0, DISPATCH_METHOD,
&dispparams, NULL, &exception, &argerr); and the documentation says that the function should have the form
HRESULT Render(
HDC hdc, long x, long y, long cx, long cy, OLE_XPOS_HIMETRIC xSrc, OLE_YPOS_HIMETRIC ySrc,
OLE_XSIZE_HIMETRIC cxSrc, OLE_YSIZE_HIMETRIC cySrc, LPCRECT prcWBounds); I guess I must have my variants set up wrong, but I just can't see the problem! Right now the parameters are put in the array in reverse order, but I've tried it in forwards order. When I run it then I get the error E_INVALIDARG. I'm very confused.
Cany you help me at all?
Joel Holdsworth
|
|
|
|
|
Joel Holdsworth wrote:
arguments[0].vt = VT_BYREF;
arguments[0].byref = &destrect;
AFAIK the VT_BYREF is not valid value of VARIANT's vt field. Look at MSDN's "VARIANT and VARIANTARG" topic and "VT_EMPTY|VT_BYREF Not valid" there.
Try to write:
arguments[0].vt = VT_BYREF | VT_I4;
With best wishes,
Vita
|
|
|
|
|
Ah thanks mate! It turned out to be just "VT_I4" in the end . Now there's a function call that is most definitly not 64-bit friendly! Thanks for the hint.
Joel Holdsworth
|
|
|
|
|
To spare yourself of lots of bulk code, do a QueryInterace for IPicture instead. It's a vtable-based interface.
Good music: In my rosary[^]
|
|
|
|
|
I am new to DCOM. I have an application that continually fails to start. Tech support has advised me to go into properties of the object in DCOM config to set launch permissions. When I right click on the object I don't have propertites to go to, on view. Tech support for the application can't even tell me how why I don't have properties available. I have tried as a user in the Administrators group, I have tried with the built in administrator account, and still nothing. Can someone please help me?
|
|
|
|
|
Hello everybody, I am a fresh in COM.
I want to create a COM in singleton mode. So there only
one instance in system. Multi clients share the object.
For example, if one client change a member of the COM
object coclass, other clients are affected.
How to implement? Is this possible?
thanks
|
|
|
|
|
if the clients are in same thread department, then it is possible, just need this macro:DECLARE_CLASSFACTORY_SINGLETON
|
|
|
|
|
Thanks
if client is in different process, is it impossible?
If you proxy & stub method, is it possible?
|
|
|
|