|
Hi,
Actually I am using MPEG2DECODER filter and I am having the "ax" extension file as well as the "lib" extension file for that filter. Can anyone tell me how to include this filter programmatically in my application?
Thank You
With regards
Raja Bose
|
|
|
|
|
Hi all!
I'am creating COM Server for structure Student i am having problem in
the following code.
IRecordInfo *pUdtRecordInfo = NULL;<br />
HRESULT hr = ::GetRecordInfoFromGuids( LIBID_STUDENTLib, <br />
1, 0, <br />
0,<br />
Student_IID,<br />
&pUdtRecordInfo );<br />
if( FAILED( hr ) ) {<br />
HRESULT hr2 = Error( _T("Can not create RecordInfo interface for UDTVariable") );<br />
return( hr );<br />
}
the problem is that GetRecordInfoFromGuids return Error what could be the
source of problem for the failure of this API.
thanks in advance.
Viral Joshi.
|
|
|
|
|
done.
It was my fault in the API GetRecordInfoFromGuids parameter Student_IID
should assign the value of uuid of student structure instread of that i was
assigning it the value of uuid of StudentLib.
Viral Joshi.
|
|
|
|
|
Hi all!
I am writing COM Server.I am using User defined data type a Student structure in COM Server.
There is a method in COM Server that returns the 1 st ranked student out of the
student array passed to it from vb client.
The Interface method is like this.
STDMETHODIMP CStudentUtil::GetFirstRankStudent(SAFEARRAY **StudentArray,Student *pStudent)<br />
{<br />
if(!StudentArray)<br />
return(E_POINTER);<br />
if(!pStudent)<br />
return(E_INVALIDARG);<br />
<br />
long lBound=-1;<br />
long UBound=-1;<br />
<br />
Student *ob1=NULL,*ob2=NULL,*max=NULL;<br />
<br />
HRESULT hr;<br />
<br />
hr=::SafeArrayGetUBound(*StudentArray,1,&UBound); <br />
hr=::SafeArrayGetLBound(*StudentArray,1,&lBound); <br />
<br />
hr=::SafeArrayGetElement(*StudentArray,&lBound,(void*)ob1);<br />
max=ob1;<br />
<br />
if(FAILED(hr))<br />
return hr;<br />
<br />
for(long i=lBound+1;i<UBound;i++)
{<br />
hr=::SafeArrayGetElement(*StudentArray,&i,(void*)ob2);<br />
if(FAILED(hr))<br />
return hr;<br />
else<br />
{<br />
if(ob2->Total>ob1->Total)<br />
max=ob2;<br />
}<br />
}<br />
pStudent=max;<br />
return S_OK;<br />
}
The client side is
Dim d As STUDENTLib.Student<br />
Set ob = New STUDENTLib.StudentUtil<br />
d = ob.GetFirstRankStudent(a)<br />
Set ob = Nothing
What is wrong with the code in the client side that result in Invalid Procedure call or argument.
Pls help on this.
Thanks in advance.
Viral Joshi.
|
|
|
|
|
Hello Joshi,
I ran through your example and discovered one -possible- point of the E_INVALIDARG error occurs at the following line of code :
hr=::SafeArrayGetElement(*StudentArray,&i,(void*)ob2);
I declared the GetFirstRankStudent() method as follows :
HRESULT GetFirstRankStudent([in] SAFEARRAY(Student)* pStudentArray, [out, retval] Student* pStudent);
The SafeArrayGetElement() API makes a COPY of the required element of the array and so you must pass a pointer to an actual Student struct object (memory allocated for it already).
Your code above sends a NULL pointer as the 3rd parameter (i.e. ob2). This is the reason for the E_INVALIDARG error.
As a suggestion, I changed your code to as follows :
//Student *ob1=NULL,*ob2=NULL,*max=NULL;
Student ob2,*max=NULL;
Student ob1;
...
hr=::SafeArrayGetElement(*StudentArray,&lBound,(void*)&ob1);
max=&ob1;
if(FAILED(hr)) // this was where the original E_INVALIDARG appeared.
return hr;
for(long i=lBound+1;i < UBound; i++)
{
hr=::SafeArrayGetElement(*StudentArray,&i,(void*)&ob2);
if(FAILED(hr))
return hr;
else
{
if(ob2.Total>ob1.Total)
max=&ob2;
}
}
memcpy (pStudent, max, sizeof(Student));
return S_OK;
Best Regards,
Bio.
|
|
|
|
|
Thanks for the kind co-operation.
I've also found the same error.
Now the code is working fine.
Once again thanks for your efforts.
Viral Joshi
|
|
|
|
|
Most welcome, Joshi.
- Bio.
|
|
|
|
|
Hai all,
I have two ATL Objects in my COM Server.
Their interfaces are
1) IFirstIFC
2) ISecondIFC
In my client programme I have imported the type library and
using code below
obtained the COM Object of IFirstIFC
IFirstIFCPtr fIF;
fIF.CreateInstance(__uuidof(FirstIFC));
Now my task is to obtain the COM Object of ISecondIFC.
My Question is , Is there any method for Obtaining the Interface
Pointer of ISecondFC by not calling again CreateInstance for that
Interface.
That is by avoiding this Code
ISecondIFCPtr sIF;
sIF.CreateInstance(__uuidof(SecondIFC));
That is,since both Interfaces are residing in the same COM Server,
Can I get the Interface Pointer of ISecondFC through IFirstIFC.
Thanks
George
|
|
|
|
|
A COM server is a COM object. This means that you actually have two servers.
They may be located in the same file, but that's another thing.
You cannot get an interface to an object without creating it.
My suggestion:
You could have the first server implement an interface method that will create the second server and by that you can avoid calling CreateInstance() from your client, but you would still have to call CreateInstance() from your first server in order to create the second one.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hai Roger,
I got it. Thank you very much.
I have another Doubt.
Is all COM communications(between COM Server and Client) happening
through RPC. Bcz, I have seen RPC header files such as "rpc.h"
"rpcndr.h" in both the COM Exe and COM Dll.
Thanks
George
|
|
|
|
|
georgekjolly wrote: Is all COM communications(between COM Server and Client) happening through RPC
No.
The most common way is to create an in-process-server running in the same thread, i.e. a single threaded apartment (STA). In this case every call to the server is exactly like an ordinary function call.
Remote Procedure Call (RPC) will be used when you're marshalling interfaces between multiple threads.
To get a deeper understanding of marshalling and RPC I suggest you read Lim Bio Liong's excellent article serie starting here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hi Sir,
Thank you very much for your help.
Regards and Thanks
George K J
|
|
|
|
|
After i have created a services in c# using the processservices class, this services contain only a method GetDate().
but can any body tell me how can i interacte with this sevices. for example, i should have a method instead of GetDate (): Establishconnection(param..) that help me to connect to an Sql2005 server (this method is with the services). And after, i should connect to this services from a client application and call this method and then get the connection with the SqlSever without having an sqlclient in the client machine.
regards, bye.
etretyertyery
|
|
|
|
|
Help !!!!!!!!!!!!!!
1. I use C&WinAPI
2. to show a dialog to select file, but you cannot manipulate it
my imagine :
1. use openfile dialog and hide the right key menu
2. i know a dialog in VB, right of the dialog is a editbox show directory list, when you select any folder in that, the left side show a file list of that folder, but it is ocx, how can i invoke it?
so, how can i do for each way. and are there any other simplest way ?
|
|
|
|
|
I got this error from command prompt
DOS/16M: [2] not a DOS/16M executable 'C:\ASMM77\ASMM77.EXE'
How i can solve this error?
Thank You.
|
|
|
|
|
Maybe the guys of [Operating Systems / SysAdmin] can help you.
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 use a third part COM API lib. I need to pass an array of double to a method which accept VARIANT*, Is there any simple way to cast from double* to VARIANT*, I don't want to create a VARIANT array and copy each double value into it.
|
|
|
|
|
Search for SAFEARRAY on this site.
Prasad
MS MVP - VC++
|
|
|
|
|
Does anyone know if there is a mechanism by which you can convert/format an HRESULT value (say 0x80004005) to a human readable equivalent (in the case of the example 0x80004005 = "E_FAIL")
Obviously I could create a static map of HRESULTS to Message Text, just wondered if there was a pre-existing way to do it?
- "I'm not lying, I'm just writing fiction with my mouth"Phil Harding. myBlog [^] | mySite [^]
|
|
|
|
|
FormatMessage will convert to the 'user-friendly' error message. It's not that user-friendly, of course, because the message is necessarily generic. The English message text is given in WinError.h , in a comment above the definition of the message constant.
Be aware that errors with codes 0x8004nnnn are relative to the COM interface you used (4 is FACILITY_ITF ) and will have different meanings for different interfaces.
I'm not sure if FormatMessage will directly handle error codes in the 0x8007nnnn (FACILITY_WIN32 ) range, which are mapped from the Win32 error codes below 65536 (using HRESULT_FROM_WIN32 ).
|
|
|
|
|
You're not thinking about ::FormatMessage() , are you?
It would give you the string "Unspecified error." for the error code E_FAIL .
But you want the string "E_FAIL", right?
If your answer is 'yes' I don't think there exist such a mapping between a C++ identifier and a string. At least not any I know.
But it does however make me question if the string should be considered "human readable"...
If I really needed that I would parse <winerror.h>.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
|
Hi,
I want to know what is the use of "extern C" in the following code snippet from a header file:
extern "C"
{
// {CA76604A-8402-472b-B115-138BAF2178BF}
extern const IID IID_IX =
{ 0xca76604a, 0x8402, 0x472b, { 0xb1, 0x15, 0x13, 0x8b, 0xaf, 0x21, 0x78, 0xbf } };
}
Vinod.C.S
|
|
|
|
|
Specifies C linkage instead of the C++ one.
see [^] and [^].
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.
|
|
|
|
|
But here v can see no functions only constant varibles .
Is the function rule applies to variable name also?
Vinod.C.S
|
|
|
|