VBA Windows Media Player in Access - WMP.Controls.play, "Object does not support ... " - vba

My Access app will allow the user to select a video file and then play it. I set off with this code.
With WMP
.URL=VideoPath
End With
This works, but you have to press the play button on the player to see the video. I wanted it to play automatically. So i cast about for the appropriate method - hopeless.
The Auto List Members action just lists Control members. Searching on the Web is VERY FRUSTRATING, but as a result i tried adding
.Controls.play
That got "Object does not support ... ", as did
.CTLControls.Play
and even
.Play
There is no conventional VBA Help listing (Properties, Methods , Events) for using WMP in VBA. (if anyone knows better please tell). I have managed to implement automatic video play in VB.Net, and it is straightforward - but in VBA it seems impossible.
I may have bumped up against a limitation of using Windows Media Player in Access, but if you can solve my problem I would be most grateful

Related

Trying to play sounds in console application VB.NET

I want to play a sound file to play in my console application but the following doesn't work:
My.Computer.Audio.Play("[file path string]", AudioPlayMode.Background)
When hovering over "my computer" it brings brings up the error 'Computer' is not a member of 'JapaneseHelper.My'. And when hovering over Audio.PlayMode it says 'AudioPlayMode' is not declared. It may be inaccessible due to its protection level.
I have searched everywhere for this and can't find anything that shows me how to do it, I've only seen instructions for forms applications (When I try to copy what is done in the form app, it doesn't work either). I've tried a couple of "Imports" such as Import System.IO but they didn't fix the issue. I don't want to open a music player, I want it to be played in the background like My.Computer.Audio.Play should do. Is it because you can't do it for a console application maybe? However I don't understand why a console apps wouldn't be able to do it.
Did you make sure that your audio file is a .wav? From the Microsoft documentation it looks like you can only play .wav files. According to the documentation it should be possible to play audio files even in a console app.

MS Office Word macro, play sound upon scrolling through certain pages

I've already got the useful tip of how to play an external audio file.
And now I'm struggling of how to use it upon reaching a certain page.
I've managed to find that I have to add the stuff below to obtain a list of events I can use:
Public WithEvents App As Word.Application
And I got a plenty of the events:
App events
But no one from them seems corresponding to what I need.
1)Find out a certain event I can use, to track any action which might change currently viewed page(mouse scroll, arrows, page up/down, mouse move with selection, or any of others..) and then paste a checking function into.
2)The checking function supposed to obtain number of current page within the document(or it's equivalent) and if we are at a certain page play corresponding sound.
There are 2 main problems I've struggled with, but got no good idea.
I also aware that we can use ActiveX object and insert an audio file into the document, it allows to even not keep the file somewhere, but embeed it into the doc.
However here I even have no idea of how to trigger playing of the file through VBA.
But if somebody can advise about it would be perfect because it even more handy, in terms of maintenance(no need to keep external audio files).
Any help is appreciated.
If you know that it's impossible in general, please also let me know, so I can close the topic.

Create a basic application that will act as a tutorial for how to use another app

I have a very particular application I have developed. I want to create a second app, ideally in visual basic, that provides a tutorial/ guide on how to use my original app step by step.
I imagine PowerPoint slide style images embedded in a simple window with forward & back controls.
I have experience in java, C & VB. Ideally the app needs be be kept simple and written in VB. Can anyone recommend a starting point, or if any tutorials for such exist? I've had a search and nothing stands out.
Thanks.
So, if this essentially just has slides and annotations and forward/backward buttons, why try to write an app for this? (I get that it might be fun to try.) You could simply do screen captures and annotate them and use PowerPoint and create an executable out of that to run.
You can even, I understand, create hyperlinks and such to allow the slide show to progress more like the real app does. I'm no "power point ranger" so I'd point you at the Office docs to learn about that, but I've seen some pretty good tutorials using this method.

Silverlight - Lync Application nested in a table

I'm very new in Silverlight and the Lync-SDK. So sorry for the question from a beginner.
Long time ago, i wrote al little web application, based on php for reading out contacts from a sql database.
Now the customer expand his envoirement and place Lync. Now he want the little Lync-Status-Square in the webapplication for click to call features.
I playing a little bit with the SDK of lync.
The following problem comes up. The square of Lync is nested in a td of my table. But the Lync-Silverlight-Applet need dynamical space for hover effects or single clicks. But in my table, i have no space, specially dynamic space.
So i switch off all hover and click functionality and place the follwing buttons in the StackPanel separate.
PresenceIndicator
StartInstanceMessagingButton
StartAudiCallButton
SendEmailButton
Two of them are fine.
Clicking on the IM-Button, The Lync Client opens the right Contact in IM-Mode and i can directly type a message. Perfect!
Clicking on the Mail-Icon, an Mail-Client will open, perfect.
The PresenceIndicator just display the color, not the exactly state, thats a problem, when the color is yellow. I can display the state in a TextBlock, but i prefer a label appears while hovering over the icon.
But my mainproblem is the StartAudioCallButton. This Icon is an dropDown-Icon. And i have no space for dropdowns. I would be so nice if this icon has the same behavoior like the IM-Button. The Lync Client will open in Call Modus and i can select, which callernumber i will use. Is that possible?
Thank you for Your time!
Frank
If you're having trouble with the layout of the standard Lync SilverLight controls, then the best thing to do is implement your own SilverLight controls for the function you're having difficulty with.
User Controls are really simple to create, there are plenty of tutorials on how to get started if you're not familiar with the process.
The Lync SDK has some great walkthroughs to get you up and running with signing in to Lync and placing an audio call
I don't know of any way to get Lync to open in a Call Mode as you suggested, but if you're limited with screen space, maybe you could have your custom StartAudioCallButton open a popup with the phone numbers in?

Supress pop-up with VB 2008 Express Edition

The radio recently broke in our bedroom and as a result my missus now listen to various radio stations through her laptop. She moans that visiting various pages and clicking the 'listen' link is a bit of a pain. (Note to self: Must buy new radio!)
In the meantime, I have made a 'radio player' in VB 2008 Express, which is nothing more than 6 buttons down the left hand side of the 'player' I have created and a Web Browser Control on the right hand side.
Clicking each button links to the relevant player of the station she wants to listen to. (Being a newbie to VB and programming, I'm quite proud with what I've achieved so far!!)
Anyway, one station I do link to gives an "Are you sure you want to navigate away from this page" prompt: This one:
http://www.mygoldmusic.co.uk/
Well, thats the homepage of the site anyway, the actual player is here:
(Oops, seems I can only post one link! The actual player opens on-click of the 'listen' button then, sorry to be a pain!)
My question is: Is there a way to suppress this message in VB, or even auto-answer OK somehow?
The other sites I have linked to do not display this message, they just navigate away quite happily. Clicking OK on the prompt is no real hardship either, I hear you say, but in the interests of usability, I would just like it to navigate away from the site/player without prompting.
Remember, I'm using Microsoft Visual Basic 2008 Express Edition. (I say that, because I've come across loads of sites that tell you how to do it with JavaScript, just not VB!)
I've got to the point of thinking it can't be done, but here's hoping!
Any help/advice would be greatly appreciated. And, sorry for the lengthy question. Hope it gives you enough info on what I'm trying to achieve.
Thanks in advance again.
J.
The only way I can think of is to actually modify the DOM of the page in the WebBrowser control. That popup is loading when the "window.onunload" event fires. You should be able to override this behaviour by modifying the DOM.
The HTML document DOM (Document Object Model, essentially an object graph of the page structure) is stored in the WebBrowser.HTMLDocument property. Unfortunately, that specific property isn't available to the .NET version. It IS available to COM however, so through some very ugly and messy code you might be able to suppress the event.
The following code should be able to access the COM property containing the HTML DOM. The type returned is IHTMLDocument2, although you'll note that the class itself will return an object. You might need to add a reference to mshtml.dll to get the IHTMLDocument2 interface access the properties of this in a reasonable way.
Dim domDocument As IHTMLDocument2 = webBrowser.HtmlDocument.DomDocument
You can then access the OnUnload event (which sits on the "window" element, one above the document). Unfortunately, the plot thickens a bit here (I did say it was going to be ugly) because you need to pass a IDispatch object to the onunload event. I've never done this specifically but I found a write-up at the following link that provides some samples and should point you in the right direction: http://blogs.msdn.com/cgarcia/archive/2009/08/28/handling-dom-events-in-a-c-activex.aspx
You should be able to follow a similar approach but simply do nothing in the handler method, which should suppress the javascript alert you are getting.
Get the handle to the dialog and destroy it. Use FindWindow and send a WM_CLOSE message to it.