Answered by:
what does this mean

Question
-
hi
I've seen this piece of come somewhere
Dim MediaPlayer = CreateObject("mediaplayer.mediaplayer")
also "MediaPlayer" has some members which intellisense doesn't show them
can somebody explain me what is it?
- Edited by NeverLieMe Monday, August 5, 2013 12:53 PM
Monday, August 5, 2013 12:53 PM
Answers
-
I don't understand. I'll be thankful if explain me more, what does CreateObject exactly do?
CreateObject creates and returns a reference to a COM object. It looks for the ProgID in the registry. The further process is described in the COM documentation:
COM is a technology and it's part of the OS. As you can see, I can not put it into few words.
EDIT:
For example, the key HKEY_CLASSES_ROOT\MediaPlayer.MediaPlayer
has a subkey called CurVer pointing to the current version, which is "MediaPlayer.MediaPlayer.1" in this case. Under that key, there is a CLSID (class ID), which is a GUID. It's value is "{22D6F312-B0F6-11D0-94AB-0080C74C7E95}"
The key HKEY_CLASSES_ROOT\CLSID\{22D6F312-B0F6-11D0-94AB-0080C74C7E95} contains, among others, the InProcServer32 sub key pointing to the dll containing the code for the class object. And so on.... But that's internals. The concept is described in the documentation. COM is all about interfaces.
Armin
- Edited by Armin Zingler Thursday, August 8, 2013 1:42 AM
- Marked as answer by NeverLieMe Thursday, August 8, 2013 10:39 AM
Thursday, August 8, 2013 1:34 AM
All replies
-
I wanted to put it into my own words, but I can't add anything to the documentation:
http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.interaction.createobject.aspx
With early binding, you have to set a reference to the library containing the definitions for the media player. Then you have to cast the reference returned by CreateObject to the specific type, and you'll have intellisense support.
Otherwise you'd have to use late-binding (option Strict Off) which is much unsafer as compile time checks are turned off.
Armin
- Edited by Armin Zingler Monday, August 5, 2013 12:59 PM
- Proposed as answer by Franklin ChenMicrosoft employee Tuesday, August 6, 2013 5:06 AM
Monday, August 5, 2013 12:57 PM -
I don't understand. I'll be thankful if explain me more, what does CreateObject exactly do?Thursday, August 8, 2013 12:58 AM
-
I don't understand. I'll be thankful if explain me more, what does CreateObject exactly do?
CreateObject creates and returns a reference to a COM object. It looks for the ProgID in the registry. The further process is described in the COM documentation:
COM is a technology and it's part of the OS. As you can see, I can not put it into few words.
EDIT:
For example, the key HKEY_CLASSES_ROOT\MediaPlayer.MediaPlayer
has a subkey called CurVer pointing to the current version, which is "MediaPlayer.MediaPlayer.1" in this case. Under that key, there is a CLSID (class ID), which is a GUID. It's value is "{22D6F312-B0F6-11D0-94AB-0080C74C7E95}"
The key HKEY_CLASSES_ROOT\CLSID\{22D6F312-B0F6-11D0-94AB-0080C74C7E95} contains, among others, the InProcServer32 sub key pointing to the dll containing the code for the class object. And so on.... But that's internals. The concept is described in the documentation. COM is all about interfaces.
Armin
- Edited by Armin Zingler Thursday, August 8, 2013 1:42 AM
- Marked as answer by NeverLieMe Thursday, August 8, 2013 10:39 AM
Thursday, August 8, 2013 1:34 AM