I've a dll and i would like to use the funtions inside but i never used COM before. :confused:

Could someone please explain if i do the right thing?

- i use the tlb2inc.exe to generate the inc from the dll and get this

;CoClass : WinGrabLibrary
sCLSID_WinGrabLibrary TEXTEQU <{09509ADD1H, 089F3H, 04D49H, {095H, 033H, 087H, 0DCH, 055H, 024H, 051H, 0D3H}}>

;DispInterface : IWinGrabLibrary
sIID_IWinGrabLibrary TEXTEQU <{071245F70H, 063D5H, 04D00H, {099H, 0D5H, 048H, 08EH, 042H, 0E6H, 0ABH, 0CAH}}>

IWinGrabLibrary_StartDirectGrabProto typedef proto IWinGrabLibrary_StartDirectGrabProto :DWORD,:DWORD,:SDWORD,:VARIANT,:DWORD,:VARIANT,:WORD,:VARIANT,:DWORD
IWinGrabLibrary_StartMuxGrabProto typedef proto IWinGrabLibrary_StartMuxGrabProto :DWORD,:DWORD,:SDWORD,:VARIANT,:DWORD,:SDWORD,:DWORD
IWinGrabLibrary_StartDirectGrabExProto typedef proto IWinGrabLibrary_StartDirectGrabExProto :DWORD,:DWORD,:SDWORD,:VARIANT,:DWORD,:VARIANT,:WORD,:VARIANT,:DWORD,:DWORD
IWinGrabLibrary_StartMuxGrabExProto typedef proto IWinGrabLibrary_StartMuxGrabExProto :DWORD,:DWORD,:SDWORD,:VARIANT,:DWORD,:SDWORD,:DWORD,:DWORD
IWinGrabLibrary_StartMuxProto typedef proto IWinGrabLibrary_StartMuxProto :DWORD,:DWORD,:SDWORD,:SDWORD,:VARIANT,:DWORD,:SDWORD,:DWORD
IWinGrabLibrary_StartMuxExProto typedef proto IWinGrabLibrary_StartMuxExProto :DWORD,:DWORD,:SDWORD,:SDWORD,:VARIANT,:DWORD,:SDWORD,:DWORD,:DWORD

IWinGrabLibrary_StartDirectGrabVal typedef ptr IWinGrabLibrary_StartDirectGrabProto
IWinGrabLibrary_StartMuxGrabVal typedef ptr IWinGrabLibrary_StartMuxGrabProto
IWinGrabLibrary_StartDirectGrabExVal typedef ptr IWinGrabLibrary_StartDirectGrabExProto
IWinGrabLibrary_StartMuxGrabExVal typedef ptr IWinGrabLibrary_StartMuxGrabExProto
IWinGrabLibrary_StartMuxVal typedef ptr IWinGrabLibrary_StartMuxProto
IWinGrabLibrary_StartMuxExVal typedef ptr IWinGrabLibrary_StartMuxExProto

_vtIWinGrabLibrary MACRO CastName:REQ
; IDispatch methods
_vtIDispatch CastName
; IWinGrabLibrary methods
&CastName&_StartDirectGrab IWinGrabLibrary_StartDirectGrabVal ?
&CastName&_StartMuxGrab IWinGrabLibrary_StartMuxGrabVal ?
&CastName&_StartDirectGrabEx IWinGrabLibrary_StartDirectGrabExVal ?
&CastName&_StartMuxGrabEx IWinGrabLibrary_StartMuxGrabExVal ?
&CastName&_StartMux IWinGrabLibrary_StartMuxVal ?
&CastName&_StartMuxEx IWinGrabLibrary_StartMuxExVal ?


IWinGrabLibrary STRUCT
_vtIWinGrabLibrary IWinGrabLibrary
IWinGrabLibrary ENDS

- i include this .inc and define this in my source

ppv dd ?

CLSID_WinGrabLibrary GUID sCLSID_WinGrabLibrary
IID_IWinGrabLibrary GUID sIID_IWinGrabLibrary

invoke CoInitialize, NULL
invoke CoCreateInstance, addr CLSID_WinGrabLibrary, NULL, CLSCTX_ALL, addr IID_IWinGrabLibrary, addr ppv

- now i should be able to use a function like

coinvoke ppv, IWinGrabLibrary, StartMuxGrab, ...

but it doesn't work :(

What's wrong?
Posted on 2002-07-17 04:04:47 by LazyT

Could you please post your *complete* source code along with the library?
Maybe a short description what the library does would be helpfull, too :)


Edit: Before you ask: You can attach your source & library as a zip file to your post ;)
Posted on 2002-07-17 04:11:13 by bazik
Wow, that's fast :)

I'm working on the Linux@dbox2 project. The dll is used to grab mpeg-streams via network from dbox2 to harddisk...
Posted on 2002-07-17 04:23:52 by LazyT
You know that this programm already exist? :)

Seems like its the only place where to get this DLL,
so I think you grabbed it from this package. Well,
it's a ActiveX DLL, written in Delphi. If you want it easy,
just use it in VB or Delphi :) Another way would be to
ask the Author if he can compile you a non-ActiveX dll.
AFAIK this is possible with Delphi (tough I never touched this crap).
Posted on 2002-07-17 04:31:25 by bazik
You're right. (If you know the dbox-project you should also know my TuxTxt ;) )

But there's a new function called Streamingserver and i would like to code a small tool like ngrab (i don't like VB).

Anyway, it's not possible to use this dll in asm? Is my code correct?
Posted on 2002-07-17 04:47:18 by LazyT
>But there's a new function called Streamingserver and i would
>like to code a small tool like ngrab (i don't like VB).

"ngrab" or "ngrep" ? :)

>Anyway, it's not possible to use this dll in asm?


>Is my code correct?


Did I mention, that I never did anything in COM with ASM ? :)

If I got you right and you ment "ngrep", you basically just want to sniff the TCP streams from the Dbox ?
Posted on 2002-07-17 04:53:35 by bazik
Posted on 2002-07-17 04:54:18 by bazik
No, i mean ngrab http://dboxupdate.berlios.de/files/ngrab0.7.60.zip

Did I mention, that I never did anything in COM with ASM ?

Cool, thanks for your help :grin:
Posted on 2002-07-17 05:00:50 by LazyT
Just taking a quick glance,
you probably need to pass a Unicode string for 'filename'.
Posted on 2002-07-17 09:55:24 by Wayne
No, doesn't work too.

But i think there's a problem with the params. With oleview.exe i get this list:

HRESULT StartMuxGrab(
long aVideoPID,
BSTR aMuxFileName,
long aSplittSize,
IDispatch** GrabControl);

Dont know if my params are correct. What's BSTR?
Posted on 2002-07-17 10:40:55 by LazyT
Do a search for BSTR on this board. There are several threads on this.

Give this a try.
Posted on 2002-07-17 12:40:21 by Wayne
Wayne, thank you very much! This one works fine :alright:
Posted on 2002-07-17 13:17:06 by LazyT
Hm, but the audio doesn't work :(

The author says that a variant array for the parameter apids is needed. I dont know how to this.

I found the SafeArrayCreate function but how to use? :stupid:

Can you help again Wayne?
Posted on 2002-07-18 13:27:22 by LazyT
Hi LazyT,
I must be getting old. I was totally looking at the BSTR

I'm sorry I did'nt have time to check it better.

Please test the attachment.
Posted on 2002-07-18 16:51:24 by Wayne
Hi Wayne,

thanks again. My fault, i've remuxed the stream and the audio is fine.

This one works now:

apids VARIANT <VT_I2,,,,<88h>>

Some functions needs up to 4 apids. But with the above method i can only set 1, right? How to handle the VT_ARRAY?

Greetings from Germany, Thomas
Posted on 2002-07-18 17:57:56 by LazyT
I did'nt realize that 'apid' was an array. Don't have any
documentation on it. To tell the truth, I'm only about 50% sure of what it does.

I'm afraid I've have no experience with using VT_ARRAY.
It looks like for VT_ARRAY you pass a pointer to an array.(just a guess)

Maybe some of the COMsperts will help out. I will try to experiment with it tommorrow.

Greetings from Northern Illinois,
land of no rain and 90 deg. F temps.
( at least for the last month and 1/2)

Posted on 2002-07-18 18:56:42 by Wayne
Here's a quick attempt at it, no promises.

You will have to fill the arrayApid with your values.
Also, the array is (4) bytes long, change it to your needs.

Posted on 2002-07-18 19:13:51 by Wayne
Sorry, seems not to work. However, i dont need more than 1 apid and this works :)

Ok, last problem. Some functions contains callback interface:

HRESULT StartMuxGrabEx(
long aVideoPID,
BSTR aMuxFileName,
long aSplittSize,
IWinGrabProcessCallback* aCallback,
IWinGrabGrabControl** GrabControl);


interface IWinGrabProcessCallback : IDispatch {

HRESULT OnMessage( BSTR aMessage);

HRESULT OnStateChange(
BSTR aName,
BSTR aState);

Do you also know how to handle this?
Posted on 2002-07-19 04:12:22 by LazyT
There's a rookie mistake in grab_3.asm

mov apid.vt, VT_I2 and VT_ARRAY should be
mov apid.vt, VT_I2 or VT_ARRAY
(I need a vacation)

As for callback's, don't know how to do it right now.
Looks like something similar to Events ?
All I can say is I'll take a further look, I would like
to know how it works.

Anybody else feel free to jump in and help.
Posted on 2002-07-19 09:10:02 by Wayne
You can probably just leave it null? Unless you want to do something in response to specific state changes/messages that the library generates.
Posted on 2002-07-19 13:37:19 by grv575