How to use the remote control of the AverMedia Cards:
-----------------------------------------------------
There are two way to use it: 'Directly accesing to the hardware', or simulating that you 
are the normal TV app.



1.- Direct access to the AverTv32.dll, no need to run the avremote application.
-------------------------------------------------------------------------------


Put those variables:

HINSTANCE hTvAver;
int (* IsRemoteDataReady)(void);
int (* GetRemoteData)(void);
int (* SetRemoteFlag)(int value);

---------------------------------------------------
Load the library:

void LoadAver(void)
{
    hTvAver = LoadLibrary("avertv32.dll");

    if (hTvAver == (HINSTANCE)NULL)
	hTvAver = LoadLibrary("aver32.dll"); // TVPhone v 1.36

    if (hTvAver != (HINSTANCE)NULL)
    {
        *((FARPROC *)&IsRemoteDataReady) = GetProcAddress(hTvAver, "AVER_IsRemoteDataReady");
        *((FARPROC *)&GetRemoteData) = GetProcAddress(hTvAver, "AVER_GetRemoteData");
        *((FARPROC *)&SetRemoteFlag) = GetProcAddress(hTvAver, "AVER_SetRemoteFlag");

        if (!SetRemoteFlag)
        {
            FreeLibrary(hTvAver);
            hTvAver = (HINSTANCE)NULL;
            ShowMessage("fail with SetRemoteFlag");
            return;
        }
        if (!GetRemoteData)
        {
            FreeLibrary(hTvAver);
            hTvAver = (HINSTANCE)NULL;
            ShowMessage("fallo con GetRemoteData");
            return;
        }

	if (IsRemoteDataReady)
	    SetRemoteFlag(0);
	else
	    SetRemoteFlag(1);
	
//        SetTimer(MixerWindow, 11, 220, NULL);
        }
     else
         ShowMessage("I didn't load avertv32");
}

//---------------------------------------------------
With a timer check this function:

void FindKey(void)
{
    static unsigned char prev=0;

    if (hTvAver!=NULL) //is library loaded
    {
     if (IsRemoteDataReady=NULL) //no 98
     {
            unsigned char Key;
            Key=GetRemoteData();

            if (Key==prev)
                return;

            prev=Key;
            switch (Key)
                // whatever you want
        }
        else //98
        
        if (IsRemoteDataReady()==1)
        {
            unsigned char key;
            SetRemoteFlag(1);
            key=GetRemoteData();
            SetRemoteFlag(0);
            key&=0xbf;
            if (key<128)
                return;

            if ((prev==key) && (IsRemoteDataReady()==1))
                return;

            prev=key;
            switch (key)
                //again select what to do
        }
        else
            prev=0;

    }
}

//---------------------------------------------------

Finaly free the library:


if (hTvAver != (HINSTANCE)NULL && hTvAver > (HINSTANCE)HINSTANCE_ERROR)
    FreeLibrary(hTvAver);



//---------------------------------------------------
Key Codes:

AverMedia (no 98)

TV	FM		Exit
104	168		72

Display	Freeze	Capture	Video
48	40	136	56

1	2	3	Audio
128	64	192	24

4	5	6	FullScreen
32	160	96	240

7	8	9	Loop
224	16	144	200

0	<	>	Mute
80	0	232	8

Color	Preview	Chan+	Vol+
176	112	216	88

AutoSca Enter	Chan-	Vol-
184	152	248	120



//---------------------------------------------------

Avermedia 98

TV	CD		Power
163	162		167

1	2	3	Video
152	144	136	128

4	5	6	Audio
153	145	137	129

7	8	9	FullScreen
154	146	138	130

0	Display	Color	Loop
155	147	139	131

()	<	>	Preview
156	148	140	132

AutoSca	Freeze	Capture	Mute
157	149	141	133

Red	Vol-	Vol+	Yellow
158	150	142	134

Green	Chan-	Chan+	Blue
159	151	143	135


---------------------------------------------------
---------------------------------------------------



Second way of accesing: 

2. Simulting that you are the TV app. The remote must be running, but not the TV
--------------------------------------------------------------------------------

To use the TVCapture98 remote control, it must be created a window named
"AVerMedia TV Tuner 98", and in its 
message loop search for the DM_REPOSITION message.

For the Avermedia TVCapture the window name is "AVerrRTV", and the
message is WM_USER + 1978


The key pressed is passed in the wParam (and some in the lParam) as
below:

Key	wParam	lParam
Autoscan3081	1
Loop	3082	0
Video	3083	0
Audio	3084	0
Mute	3085	0
Vol+	3086	0
Vol-	3086	1
Channel+3087 	0
Chann-	3087	1
Display 3088	0
Freeze	3089	0
Capture	3090	0
Fullscr	3091	0
Preview	3092	0
Color	3093	1
Digits
(0-9)	3094	(digit)
-	3096	0
+	3097	0


Power	3014
TV - CD 3010, 3012, 3015, but I would advise not to use those keys

for the TVCapture use wParam+80-> 
v.98: autoscan=3081,1
v no 98: autoscan=3001,1

and these keys:
Enter	3012	2
Exit	3015	0
TV-FM	1026,1027



If the name of the window is "AVerCD", the keys are:
Red (play)   4021 0
Green(pause) 4022 0
Yellow(stop) 4023 0
Blue (eject) 4028 0
Vol+	4029	0
Vol-	4030	0
Chann+	4026	0
Chann-	4027	0
Power	4031	0

Remote only sends messages to one window, and it depends on the 'state':
that is: if it is in TV-mode or CD-mode (a button for each), and user
switch between them pressing each button.






This information isn't official, I guessed it at home, so don't blame me if 
it doesn't work with other cards.
The info for the non-98 cards has been found by QQ: cescqq@geocities.com

If you find some error or improvement just let me know it.
Also I would like to know if you use this info, what have you done with it.

amla@lycosmail.com


