Windows Media Player 10 ActiveX Control

Reports of bugs and issues with Phoenix.
Adam Ritchie
Member
Posts: 44
Joined: Mon Sep 20, 2004 2:46 pm

Windows Media Player 10 ActiveX Control

Postby Adam Ritchie » Tue Jan 24, 2006 2:13 am

Hmmm, this is interesting. I was playing around with some ActiveX controls in Phoenix and decided to add the WMP 10 control to the palette and dropped it on a simple form, I set a media file to the control with the Custom property and then attempted a build and execute and the compiler spits this out:

Error 420 in C:\Program Files\Phoenix\bin\projects\mplayer\mplayer.bas[1901:70]; Relational Operator Expected
Line 1901: ByVal @pvapi[0]

This is the sub procedure generated by Phoenix:

Code: Select all

SUB Form1_WindowsMediaPlayer1_CreatePartnershipCompleteCP _
  ( _
  BYVAL pThis       AS DWORD, _         ' [in] automation object (IDispatch)
  BYVAL lParam      AS LONG, _          ' [in] application-defined value handle of OLE container)
        pDispParams AS DISPPARAMSAPI, _ ' [in,out] pointer to a structure containing an array of arguments
        pVarResult  AS VARIANTAPI _     ' [out] pointer to a Variant or NULL if the caller expects no result
  )

  LOCAL pvapi   AS VARIANTAPI PTR
  LOCAL pv      AS VARIANT PTR

  pvapi   = pDispParams.rgvarg
  pv      = pvapi

  Form1_WindowsMediaPlayer1_CreatePartnershipComplete pThis, _
                                                      lParam, _
                                                      BYVAL @pvapi[1].vd.punkVal, _
                                                      BYVAL @pvapi[0]

END SUB


Adam

TechSupport
Site Admin
Posts: 809
Joined: Tue Sep 14, 2004 7:55 pm
Location: Mississauga ON, Canada

Postby TechSupport » Tue Jan 24, 2006 11:29 pm

That's not good.
Post the declaration Phoenix generates for the CreatePartnershipCompleteCP event. It is located at the beginning of the *.bas file.

Adam Ritchie
Member
Posts: 44
Joined: Mon Sep 20, 2004 2:46 pm

Postby Adam Ritchie » Tue Jan 24, 2006 11:40 pm

Ok Dominic, here is the prototype:

DECLARE SUB Form1_WindowsMediaPlayer1_CreatePartnershipComplete(BYVAL pObject AS DWORD, BYVAL lParam AS LONG, BYVAL pDevice AS DWord, _
BYVAL hrResult AS Long)

Adam

TechSupport
Site Admin
Posts: 809
Joined: Tue Sep 14, 2004 7:55 pm
Location: Mississauga ON, Canada

Postby TechSupport » Wed Jan 25, 2006 12:05 am

Thanks. It appears the code generator did not understand the VARTYPE.
I downloaded version 10. I can't wait to see what the VARTYPE is.

Actually, it did. This is a scenario José and I discussed. Something is amiss in the code generator.

José Roca
Member
Posts: 45
Joined: Wed Sep 15, 2004 5:37 am
Location: Valencia, Spain
Contact:

Postby José Roca » Wed Jan 25, 2006 12:57 am

Hi Dominic,

The vartype is VT_HRESULT

Code: Select all

'  =======================================================================================
'  Parameters in DISPPARAMS are zero based and in reverse order
'  =======================================================================================
'  *** pDevice - VarType: VT_PTR->VT_USERDEFINED - Resolved VarType: *IWMPSyncDevice <interface> - Attributes: &H1 -  [in] ***
   LOCAL pDevice AS DWORD : pDevice = VARIANT#(@pv[1])
'  =======================================================================================
'  *** hrResult - VarType: %VT_HRESULT <LONG> - Attributes: &H1 -  [in] ***
   LOCAL hrResult AS LONG : hrResult = VARIANT#(@pv[0])
'  =======================================================================================

If I remember well, our discussion was about declaring the event function as a procedure or as a function if the return type was VT_VOID or VT_HRESULT, and passing and additional parameter, that will be returned in pvarResult, otherwise, as it happend with the "bubble" flag of MSHTML.

As in this case hrResult is a normal parameter, but of the type VT_HRESULT, maybe your code generator is being confussed somewhere.

TechSupport
Site Admin
Posts: 809
Joined: Tue Sep 14, 2004 7:55 pm
Location: Mississauga ON, Canada

Postby TechSupport » Wed Jan 25, 2006 1:36 am

It's being confused alright, because the code does not see VT_HRESULT as automation compatible.

José Roca
Member
Posts: 45
Joined: Wed Sep 15, 2004 5:37 am
Location: Valencia, Spain
Contact:

Postby José Roca » Wed Jan 25, 2006 2:17 am

And it isn't, but Microsoft always come with surprises and sometimes breaks it's own rules. I'm also going to modify a function used in my browser that returns the union member name to return plval.

TechSupport
Site Admin
Posts: 809
Joined: Tue Sep 14, 2004 7:55 pm
Location: Mississauga ON, Canada

Postby TechSupport » Wed Jan 25, 2006 2:28 am

I have been trying to figue out which member it is. How did you settle on lVal | plVal? That was my first guess but....

José Roca
Member
Posts: 45
Joined: Wed Sep 15, 2004 5:37 am
Location: Valencia, Spain
Contact:

Postby José Roca » Wed Jan 25, 2006 2:48 am

Well. VT_HRESULT indicates an HRESULT, and HRESULT is defined as a LONG, so lVal/plVal are the most appropiate. Here is a list of vartypes and what they indicate: http://msdn.microsoft.com/library/defau ... stopic.asp

TechSupport
Site Admin
Posts: 809
Joined: Tue Sep 14, 2004 7:55 pm
Location: Mississauga ON, Canada

Postby TechSupport » Wed Jan 25, 2006 3:30 am

The problem is that Microsoft keeps breaking their own rules. VT_HRESULT should not be in a variant.

José Roca
Member
Posts: 45
Joined: Wed Sep 15, 2004 5:37 am
Location: Valencia, Spain
Contact:

Postby José Roca » Wed Jan 25, 2006 3:42 am

Agreed. But when Microsoft makes a mistake our only choice is to find a workaround.

TechSupport
Site Admin
Posts: 809
Joined: Tue Sep 14, 2004 7:55 pm
Location: Mississauga ON, Canada

Postby TechSupport » Wed Jan 25, 2006 12:33 pm

The workaround for this problem in the current version is to tell Phoenix not to generate the CreatePartnershipComplete event.
1. Open the WindowClass property editor.
2. Go to the Custom Styles/Custom Messages page.
3. Uncheck the CreatePartnershipComplete event.
4. Click OK when done.


Return to “Phoenix Bug Reports”

Who is online

Users browsing this forum: No registered users and 1 guest