|
I'm trying to access an an XAudio2 interface (IXAudio2 for example) in C#.
Some background: I'm writing a tool that will allow a sound artist to play back some music (among other things). I require playback of streaming multichannel audio from any location in the file, the tool is written in C#. DirectSound is depricated, XACT can't do this as far as I know, other packages (NAudio and SlimDX) are options but I'd like to stick with what our artists already have installed if possible. That leaves me with xaudio2, but it's not managed.
I've scanned my registry and opened the XAudio2 dll in OLE-COM Object Viewer, as well as several dll inspectors, none list the interfaces in the coclass. I'm following the directions here to access the COM interfaces but I require the IID of interfaces like IXAudio2.
Is there any way of getting this information or am I going down the wrong path all together?
TIA
|
|
|
|
|
I found the answer. The GUID's are supplied in the xaudio2.h header files supplied in the xdk. I feel silly for not looking there earlier, but perhaps this will help someone else with a similar question.
Cheers
|
|
|
|
|
Yes, it did help me, thanks! (in C++, just use the GetClsid() function...)
|
|
|
|
|
I'm trying to do this error-free.
I'm writing context menu shell extension that will navigate current Explorer window through IShellBrowser acquired through IObjectWithSite and so far I have this (omitting unimportant code):
header file
class ATL_NO_VTABLE CShellTarget :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CShellTarget,&CLSID_ShellTarget>,
public IShellExtInit,
public IContextMenu,
public IObjectWithSiteImpl<CShellTarget>
...
private:
CComPtr<IShellBrowser> m_pShellBrowser;
...
};
and here I override SetSite method, but I'm not sure if this code is OK
HRESULT CShellTarget::SetSite(IUnknown *pUnkSite)
{
ATLTRACE("IObjectWithSiteImpl::SetSite\n");
IObjectWithSiteImpl<CShellTarget>::SetSite(pUnkSite);
if (m_spUnkSite!=NULL)
{
CComQIPtr<IServiceProvider>; sp = pUnkSite;
sp->QueryService(SID_SShellBrowser,IID_IShellBrowser,(void**)&m_pShellBrowser);
}
else m_pShellBrowser.Release();
return S_OK;
}
It's hard to find one representative code sample of IObjectWithSite and Google isn't that much helpful.
(btw yea I know about WM_GETISHELLBROWSER hack)
Help is appreciated.
|
|
|
|
|
Hi All,
I have tried to use QueryInterface by using the following code segment.
The COM component had been created by me with two interfaces. The following code works fine with CoCreateInstance function.
When i try to obtain the another interface using "QueryInterface" returns E_NOINTERFACE.
Kindlly help me, by tracking mistake(s) if any.
Thanks,
Ganesamoorthy
HRESULT hr;
IGreet *greetObject;
IGreet2 *greetObject2;
CString strTemp;
hr = CoInitialize(NULL);
if (FAILED(hr) )
return ;
hr = CoCreateInstance(CLSID_Greet2,NULL,CLSCTX_INPROC_SERVER, IID_IGreet2,(void **)&greetObject2);
if (FAILED(hr) )
{
CoUninitialize();
return ;
}
greetObject2->AddRef();
cout << greetObject->Sayhello("Ganesh") << endl;
CComBSTR bstrVal, bstrVal1;
bstrVal1.Append ("Ganesh");
greetObject2->SayHello2(bstrVal1, &bstrVal);
strTemp.Format (_T("%s"), bstrVal);
MessageBox (strTemp);
hr = greetObject2->QueryInterface(IID_IGreet,(void **)&greetObject);
DWORD dw = GetLastError();
if (FAILED(hr) )
{
CoUninitialize();
return ;
}
CoUninitialize();
modified on Thursday, January 27, 2011 5:10 AM
|
|
|
|
|
|
I have a plugin that I'm developing that is used in a COM environment. The issue is, I seem to be able to readily obtain an pointer to a base class of my class, but I'm unable to figure out how to get a pointer to my main class.
Here is my class:
class ATL_NO_VTABLE Plugin :
public CDXBaseNTo1,
public CComCoClass< Plugin, &CLSID_Plugin >,
public IDispatchImpl< IPlugin, &IID_IPlugin, &LIBID_MAINLib >,
#if(_ATL_VER < 0x0300)
public CComPropertySupport< Plugin >,
#endif
public IObjectSafetyImpl2< Plugin >,
public IPersistStorageImpl< Plugin >,
public ISpecifyPropertyPagesImpl< Plugin >,
public IPersistPropertyBagImpl< Plugin >,
public CSFVideoPlugin< PLUGINPROPS >
The CSFVideoPlugin is derived from the ISfExchangeProps< PLUGINPROPS > interface.
Then, in another are of the plugin environment, the Property Page to configure it, I can do the following:
CComQIPtr< ISfExchangeProps< PLUGINPROPS >, &IID_ISfExchangeProps >
pxPlugin( m_ppUnk[ 0 ] );
This part all works fine, and calls into the pxPlugin work fine. When inside a method call there, the debugger shows [ATL::CComContainedObject<Plugin>] as the first "member" of this , so the relationship is known, or so it would seem. But calls like this return a completely bogus pointer:
CComQIPtr< Plugin, &IID_IPlugin >
pxPlugin( m_ppUnk[ 0 ] );
The memory is in the same basic area, but the values are all messed up, and in fact setting them on occasion can/will crashes.
I can't figure out how to query for that CComContainedObject interface. Given that even the debugger has enough information to track it down though, clearly it must be.
Any help would be greatly appreciated. If I haven't provided a piece of information that would be useful, please let me know.
Thanks, CraigL
|
|
|
|
|
Hi friends,
My product have a ATL/COM based C++ service (32 bit). It get registered and run fine on XP 32 bit and Vista 32 bit.
But now I want to run the same on Windows7 64 bit also. I tried to register the service the following way:
1 I did Copy MyService.exe at C:\Windows\SysWOW64.
2 Then executing "C:\Windows\SysWOW64\MyService.exe" -RegServer from Start->Run
3 Then executing "C:\Windows\SysWOW64\MyService.exe" -Service from Start->Run
But my service is not getting registered. While registering it, I don't get any error message. Also I didn't find any entry in event viewer (I saw event viewer first time. Don't know where to see the log about registration of my service). And I didn't find entry for my service at Control Panel\Administrative Tools\Services.
Please advise me how can I register my service?
Thanks in Advance
Regards
|
|
|
|
|
Do not repost the same message in different forum. You send this message in vc++ forum and ATL forum as well.
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
I had been interviewed with a comp .. during course of interview guy asked me question like.
1)How COM and DCOM differ on code level.
2)and what are the advantages of using COM over DCOM
can somebody please explain these..
thanks
vikas da
|
|
|
|
|
In the code level they can be exactly the same.
If you have a COM EXE, you can run the dcomcnfg tool and configure it for DCOM.
DCOM is COM with some permissions and access control.
|
|
|
|
|
See here[^].
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
|
|
|
|
|
DCOM (Distributed COM) is nothing but COM over network.
"Don't confuse experts with facts" - Eric_V
|
|
|
|
|
In my application Iam calling a method in C# in the fallowing way. It is a com method.
Array ar = iFuncs22.GetCheckEntriesNew();parameter to function is an IID.purpose of this function is to get all the properties of a structure named "Entry" into an array. Implementation of function GetCheckEntriesNew()is in VC++ like
STDMETHODIMP CARadApi::GetCheckEntriesNew(long CheckId, LPSAFEARRAY *pRetVal)
In the implementation part everything is fine except in the call
hr = SafeArrayPutElement(psaEntriesNew, &index, &ce1);
here ce1 is a "Entry" strucure which is filled properly.But while putting ce1 values into Array using "SafeArrayPutElement" values are changing. some random values are appering. Please let me know the solution. Thanks in Advance
|
|
|
|
|
Are you sure you don't have memory errors somewhere in your program? I've used COM's SafeArrayPutElement without a problem, but I have seen very weird errors like those you describe when applications have memory errors. This is often due to someone forgetting that Excel often passes unitialized values to dlls.
|
|
|
|
|
Hello,
I am using DIA SDK for extracting user defined complex types(just I used in my C++ code). I don't know all my types(used in code) before extracting from DIA SDK with names and members(data members& functions).
It shows everything, I mean all those user defined types which I don't need at all(i.e kernel types and enums & structs). I only want to enumerate those which are strictly used in my code(i.e in Dll/EXE in any format).
Is there is any way out at all by which we can restrict those unwanted (Kernel source types or MSFT specific source code) types to appear?
Regards
Usman
|
|
|
|
|
glitteringsound wrote: It shows everything
What does this mean, what is it that does the showing? You need to explain your problem a bit better if you want a suggestion to help you.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
I statted completely..
Rephrasing..It shows every user defined type that's not used or declare inside my code. I mean If I have declared and use "MyClass" as class in my dll/exe then it should enumerate only this.
It enumerates all those UDTs(User Defined Types)which 's not used or declared in my binary(dll/exe).Those comes from kernel modules and libraries. As we know that every program implicitely linked with some kernel imports(i.e kernel32.lib,user32.lib, gdi32.lib, winspool.lib ,comdlg32.lib....).
I only need strictly those user defined types those I declared inside my source code.For this I can give or hardcode that user defined type to which I want to enumerate. But this is not the solution of the problem. Some I don't know earlier the name of type used in my source code. In that case I need list of all of those types which I used or declared in my source code.
|
|
|
|
|
glitteringsound wrote: It shows every user defined type
Once again what do you mean by 'It' here. What exactly are you doing (or is something else doing) that shows whatever it is that you do not want to see. You also mention enumeration, again who or what is doing the enumerating and what are they enumerating. Sorry but I am very confused.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
DIA SDK is the API available by Microsoft under C:\Program Files\Microsoft Visual Studio 10.0\DIA SDK\...
It always gives you the debugging information 2 or 3 times more than that of Dbghelp and DbgEng etc. It enumerates pdbs and allows the users to extract information like
1 - Types(names) & base class details.
2 - Members(Their names and full signature details, parameter offsets and methods RVA)
3 - Type data members.
and lot more what ever you required.
My problem is that yes I want to enumerate all these things. But basically my problem is that I don't want the details(which I mentioned above ) of all those types which are not defined in my code.What It does now , it starts from kernel modules (Dll's) , enumerates the details(i.e types , method associated with that type and so on..) and trail down to the end of the user defined types(classes',structs and enums).
I only want my types (which are strictly defined in my code) to be enlist. I don't want all kernel related types.i.e contained inside (MSCVP100.dll,KERNEL32.dll,User32.dll,Ole32.dll,OleAut32.dll).
If still any confusion is there let me know then..
|
|
|
|
|
I have not used DIA but looking at the documentation there does not seem to be an obvious solution to your problem. I suspect part of the problem is the extra information that is added to the PDB when you include a header file that defines Windows functions; everything is included in the PDB even if it is not directly referenced in the final .exe file. There seem to be lots of pointers in the section on Symbols and Symbol Tags but no direct suggestion relevant to your question. Since this is a rather specialised subject you may be better trying one of the Microsoft forums that deal with the subject.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hello,
Can we calculate/extract Virtual Table address some how from DIA SDK?
Regards,
Usman
|
|
|
|
|
The original pointer you receive on CoCreateInstance()[^] points to the vtbl. However since this is an internal COM object you cannot rely on any of its contents if accessed other than through the proper COM calls.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
I have Simple Win32 type which have some virtual functions. I want access the base pointer of virtual table. Some how If I can pass type and it returns the existing vtable's start address...?
|
|
|
|
|
I am afraid I am a bit confused now. As I said before the vtbl pointer of a COM object is returned to the caller from CoCreatInstance() . I don't understand what this has to do with virtual functions in your Win32 application; perhaps you could clarify.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|