|
-
November 25th, 1999, 09:11 AM
#1
VB client, VC server
Hi there,
i'm a beginner using COM/DCOM..i have an ATL server..which has an interface function with 3 out parameters...returned back to the client as double*...i'm able to access the function in my VB client...but...its giving me the "argument by reference mismatch error"...my function in the interface of my server is as follows STDMETHODIMP CMyinterface::Get(double *x, double *y, double *ammun)...my VB client code looks sth like this
Private Sub Form_Load()
Dim x, y, z As Double
Dim obj As FPSERVERLib.Myinterface
Set obj = New FPSERVERLib.Myinterface
obj.Get x, y, z//////its giving me error at this point
Text1.Text = x
Text2.Text = y
Text3.Text = z
End Sub
Thank you once again for your time..and any help is apppreciated.
Vishal
-
November 26th, 1999, 02:22 AM
#2
Re: VB client, VC server
Hi,
Try changing your ATL function declaration from:
STDMETHODIMP CMyinterface::Get(double *x, double *y, double *ammun)
to
STDMETHODIMP CMyinterface::Get(double **x, double **y, double **ammun)
{
*y = 10; // Or what every value you use.
}
Because your trying to receive reference values from a COM object, you may need to pass in a double-dereference operator, to get the values from the COM object across to the VB client.
You don't need to do anything in the client, just the server.
Hope this helps.
-
November 26th, 1999, 05:28 AM
#3
Re: VB client, VC server
Hi, its got nothing to do with COM :-)
This is VB syntax quirk. UNLIKE in VC,
a definition of
Dim x, y, z as Double
means
DIm X as Variant, y as Varient , z as Double
Change it to
DIm X as Double, y as Double , z as Double
it should work
RK
-
November 26th, 1999, 08:02 AM
#4
Re: VB client, VC server
Thanx ravi...i knew somewher i made a silly mistake...now the new problem's one of my client sends data to the server and the other retrieves the same data..the second client retrieves correct data...as long as the server's active...but after that it retrieves junk....how do i make the server always active....as long as the 2 clients r connected...thanx once again for ur help.
-
November 29th, 1999, 04:02 AM
#5
Re: VB client, VC server
In the server is strong ( in error handling) , COM makes sure that the server keeps running as long as any client is connected to it or keep a reference of the server. ( Another reason as to why even clients should do a clean exit!)
I dont know, if you should make special efforts to keep the server alive.
Dont just say:
perror("Something went wrong!!");
exit(1); type of codes, in the server
When server not active, clients not able to communicate is just natural, right?
In the client side, make sure that the server variable has global/modulelevel global scope so that you are sure. VB may generate error 91, but it could be negated with on Error resume next kind of code.
That's being as general as i(t) can get!!!.
RK
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|