hi
im kind of a dodo in VB6
as a part of my project im trying to build a media player in vb using Windows Media Player control but the code that i had written on another system (windows 2000) is not working on my system (windows xp). the error says that object does not support this property or method
is it a problem of the os????
please can u help me?????????

Dani AI

Generated

Good catch by and a nice confirmation from — this is a classic ActiveX/version mismatch rather than an OS bug. Two short, practical points that will help others who hit the same symptom.

First, quick diagnosis steps

  • Open Windows Media Player and check Help -> About to see which player version is actually installed.
  • In VB6 use Project -> Components to confirm which Media Player control your project references; remove and re-add it on the machine where you edit if it looks wrong.
  • Use the Object Browser (F2) on the development machine to inspect the control members you actually have available; that shows exactly which method/property names your code should call.

Second, ways to avoid the problem going forward

  • Don’t bake a design-time file path or media property into the control. As hinted, assign the file at runtime (Form_Load) so the project isn’t carrying a version-specific property value.
  • If you need maximum cross-machine compatibility, use late binding so the project doesn’t require a particular typelib at compile time. Example pattern (VB6):
    Dim player As Object
    Set player = CreateObject("WMPlayer.OCX")   ' ProgID can vary by install
    player.URL = "C:\path\file.mp3"
    ' Invoke the play method available on the runtime control version
  • If a control disappears or behaves oddly, re-register the player ActiveX on the target machine (use regsvr32 on the correct DLL/OCX for that install) and then re-add the component in VB6.

Final checklist

  • Rebuild and test on the oldest target machine you plan to support.
  • Inspect members with the Object Browser before coding against them.
  • For broad redistribution, consider either shipping a tested player version requirement or using a playback library with a stable redistributable.

This keeps the project resilient to the kind of version shifts that caused the original error.

Recommended Answers

All 6 Replies

Please pass few more details . It is very difficult to suggest anything based on the very little info passed by you.

hmm i had a prob just like this b4,

but i dnt knw if its the same on your prob.

well, try loading the file by making a syntax or code it inside you form_load of watever you used

this works on me. cause i get errors if i just set it on the property window.
and then transfer my work on another PC wt diff OS

post the code segment where u r getting the error. may be this error is occurring due to version confliction for the controls.r u using windows media player control 6.4(in xp) or installed the new version externally?

should i attach the existing code???
does the windows media player control available in vb depend on the version installed on the computer

we all know that's the result of ur hard work.but if u do not clearly state the problem how can somebody be able to figure this out?either u post the specific part where r u getting the error or completely describe the problem.

the other thing is, the version of the windows media player activex control is very much depended on the windows media player that u install in ur machine. by default when u install vs6.0 it installs the version 6.4 but if u install the microsoft windows media player externally(from any source)the version will be it happens u cannot be able to use the older version anymore.even if u used the old control in ur program, after the upgradation the existing control in ur program will not be recognized by the vb itself. then u can be able to run the executable only(if created). let's for example, u used wmp 6.4 ocx. now u installed wmp 10 in the same os. now if u try to run ur existing code u will fetch erros associated with the wmp control. these errors actually occur due to change in the methods and properties of the control in diff. versions. like if u wanna play a file using wmp 6.4 u code mediaplayer1.play, but if u use wmp 10 or some other higher version the equivalent syntax will be mediaplayer1.controls.play, so in this case after upgradation of the control the previous syntax will not be recognized by vb and it will give u the error as u stated in this post. the error will occur due to the change in mediaplayer1.play to mediaplayer.controls.play .

i hope this lecture will help u in some context.
good luck.

hi shouvik
thanks a million ur lecture really helped the problem was the same one that u described
after i changed all the methods such as mediaplayer.play to mediaplayer.controls.play all the controls have started working
thanks a million again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.