|
write the following code
IGraphBuilder* g_pGraphBuilder;
IBaseFilter *MyFilter;
HRESULT hr
hr=AddFilterByCLSID(g_pGraphBuilder,CLSID_VideoRenderer,NULL,&VideoRendrer);
where the function is
HRESULT AddFilterByCLSID(
IGraphBuilder *pGraph, // Pointer to the Filter Graph Manager.
const GUID& clsid, // CLSID of the filter to create.
LPCWSTR wszName, // A name for the filter.
IBaseFilter **ppF) // Receives a pointer to the filter.
{
if (!pGraph || ! ppF) return E_POINTER;
*ppF = 0;
IBaseFilter *pF = 0;
HRESULT hr = CoCreateInstance(clsid, 0, CLSCTX_INPROC_SERVER,
IID_IBaseFilter, reinterpret_cast<void**>(&pF));
if (SUCCEEDED(hr))
{
hr = pGraph->AddFilter(pF, wszName);
if (SUCCEEDED(hr))
*ppF = pF;
else
pF->Release();
}
return hr;
}
RajeshGupta
|
|
|
|
|
Hi Rajesh,
Thank you very much for replying, As you said in the following case
IGraphBuilder* g_pGraphBuilder;
IBaseFilter *MyFilter;
HRESULT hr
hr=AddFilterByCLSID(g_pGraphBuilder,CLSID_VideoRenderer,NULL,&VideoRendrer);
CLSID_VideoRenderer this one is not known to me. The classid like 2345-2445-3245-543456 (for example CLSID_VideoRenderer = 2345-2445-3245-543456)which I got from DxFilterSpy.exe is known to me. So can you tell me how do I add this Classid in my application and relate it to my base class filter
Awaiting for your reply
Thank You
With regards
Raja Bose
|
|
|
|
|
CLSID_VideoRenderer defined in uuids.h header file in directx sdk
if you want to include any CLSID that is not in uuids.h
the see DirectShow FAQ in directshow helpfile
RajeshGupta
|
|
|
|
|
Hi guys,
Thanks for taking the time to read this post.
I've got an ActiveX control embedded in a web page:
<html><OBJECT id="myFoo" width="640" height="480"
style="position:absolute; left:100;top:100;"
CLASSID="CLSID:f1387dda-43c0-4406-99a1-c1e0eaf1b5c8"
codebase="http://blahblah/FooClientAxSetup.cab"
type="application/x-oleobject">
</object></html>
That cab file contains 3 files: My setup.MSI file, setup.exe, and my .inf file which should tell Internet Explorer to launch my setup.exe file. Here's the .inf file:
[version]
signature="$CHICAGO$"
AdvancedINF=2.0
Hook=runInstaller
[runInstaller]
run=%EXTRACT_DIR%\setup.exe
I launch the page in IE7. It prompts me to install. I say yes. Nothing happens. What am I doing wrong?
|
|
|
|
|
I'm trying to do something that might actually be a bit silly. I'm accessing what is essentially a windows form from an aspx page, to do some printing from the server side for me.
I have the following code:
public class axForm : System.Windows.Forms.Form
{
public AxDHTMLEDLib.AxDHTMLEdit axd;
public axForm()
{
Thread.CurrentThread.ApartmentState=ApartmentState.STA;
axd=new AxDHTMLEDLib.AxDHTMLEdit();
((System.ComponentModel.ISupportInitialize)(axd)).BeginInit();
this.Controls.Add(axd);
axd.Enabled = true;
axd.Name = "axd";
((System.ComponentModel.ISupportInitialize)(axd)).EndInit();
}
public void printDoc(string sHtml, bool bPrompt)
{
axd.DocumentHTML=sHtml;
object filename=@"c:\fileouttest.txt";
for(;axd.Busy!=false;)
{
System.Windows.Forms.Application.DoEvents();
}
axd.SaveDocument(ref filename);
object opt=null;
if (bPrompt)
opt="1";
axd.PrintDocument(ref opt);
}
}
Basically I create an instance of that class in my aspx code behind, then call printDoc with the HTML I want to print and an indicator as to whether or not I want to see the print dialog (I don't but the code I based this on had the boolean in there and I thought it might be useful for testing).
The problem is I'm getting a HRESULT error message and I don't know what to do about it. I'm guessing, since the error is fired just after the .endInit() line that it's something to do with how I'm setting the thing up in the first place, but I don't know enough about it to be able to debug it properly. The error is:
'System.Runtime.InteropServices.COMException' occurred in system.windows.forms.dll - Additional information: Exception from HRESULT: 0x80040200.
Can anyone help me figure this out? It seems like I'm really close to getting it working. If I tone down the amount of debug information I want, it actually runs without giving any errors at all, and the line that saves the document to disk actually works regardless, so I'm a bit confused. Any help would be greatly appreciated.
|
|
|
|
|
Hi,
Can anyone let me know URL or book where I can find the depth of STA and MTA.
Thanks
Nandu
|
|
|
|
|
|
Hi,
Can any help me in understnding proxy/strub in COM. Is there any website where I can find more info about this?.
Nandu
|
|
|
|
|
Read the following book
Inside COM - Dale Rogerson
It will help you get started with COM.
S o h a i l K a d i w a l a
To Err Is Human; to Debug, Divine
modified 21-Apr-21 21:01pm.
|
|
|
|
|
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.
|
|
|
|