|
Hi,
The original c# code in the CP article http://www.codeproject.com/KB/audio-video/a_mini_media_player.aspx[^]was this:
private void OpenMediaFile()
{
ClosePlayer();
string playCommand = "Open \"" + fileName +
"\" type mpegvideo alias " + mediaName;
mciSendString(playCommand, null, 0, IntPtr.Zero);
isOpen = true;
}
I haven't programmed in Basic since QuickBasic, which dates me a bit, but I don't think you have translated the formatting of the playCommand string correctly.
The c# code produces, from a fileName of c:\music.mp3 and mediaName of media, the string
Open "c:\music.mp3" type mpegvideo alias media
Alan.
|
|
|
|
|
Thanks for responding. I think it was your code where I took it to test. I corrected the code after your post but it is still not working. Somehow it is not talking to winmm.dll.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Hi,
Are you able to compile the original c# source. I've just done that and the app will play mp3 and wav files perfectly on my system. If you were able to do the same at least you would know whether your computer or your translation is the cause of the problem.
Alan.
|
|
|
|
|
I beleive that your code is perfectly running in C#. The problem is it is not communicating winmm.dll I made a mistake somewhere and I will eventually find it. Do you know any more developed class file somewhere where I can download it?
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Hi,
I haven't come across anything like that.
Alan
|
|
|
|
|
Just tested the VB.NET code. As Alan states, there's a translation error from C# to VB.NET here:
'This procedure will open the media file
Private Sub OpenMediaFile()
ClosePlayer()
Dim PlayCommand As String = "open """ + GetFileName + """ type mpegvideo alias MediaFile"
mciSendString(PlayCommand, Nothing, 0, IntPtr.Zero)
isOpen = True
End Sub
Enjoy
I are troll
|
|
|
|
|
Hi. First off I apologize if I'm posting this in the wrong forum, this is my first time posting here. I'm working on a project and a segment of the project deals with random stat (stat as in rpg stats) generator and I've encountered a bit of a problem. The program, which we'll call Character Creator for now, offers the user three ways to generate six stats. Rather than posting all of the code (which is about 750 pertinent lines) I'll describe how the first method works. This method is the equivalent of adding the result of four six-sided dice, re-rolling on ones, and dropping the lowest number.
Here is a screen shot of the design view of my program[^]
This image shows how the check boxes allow the user to assign a single stat to each number[^]
Because of how time consuming it took to make just one generator on the form, I made it into a user control so I could simply drag and drop it onto the form three times, thus giving the user the ability to select from one of three different sets of numbers to work with. This is where the problem comes in. My problem is that I don't know how to access the text boxes or check boxes in the control or is such a thing is possible. For example, this what I first tried to see if I could still access components and variables of the control:
'genOne is the name of the first generator
'txtStatOne is the name for the first text box in the column
'statOne is the name of the random variable
genOne.txtStatOne.text = statOne
I need to do this because after the set of numbers is selected and assigned to a stat, it will be sent to be stored in a database along with other pieces of information. This part has yet to be implemented so on the form there will be a "Finish" button that sends all entered information to a database. Any help is much appreciated.
|
|
|
|
|
First, I think the UI you've come up with is confusing, but hey, it's your app.
Next, you had the right idea putting this in a User Control. The problem is you have to write some code in the User Control to expose the data in the text boxes and checkbox's in a manner that would make sense to an outside consumer, like your main form, using public properties and/or events. You do NOT expose the constituent controls outside of the User Control.
|
|
|
|
|
Ah, thanks much for pointing me in the right direction. I've messed around a bit with the code and it looks like everything is working fine.
However I've got one more question. You said the UI was confusing. How so? As this projects wears on I hope to have a list of questions and such about the program or possible revisions.
|
|
|
|
|
XaviousWolffe wrote: You said the UI was confusing. How so?
How you noticed all the checkbox's you've splattered all over the screen?? Wouldn't be better to setup a drag'n'drop solution to move the values to the appropriate attributes??
|
|
|
|
|
How can I write a shell extension with Visual Basic 2005 / 2008 Express? Any help would be most appreciated, but I'm looking for info that would allow me to create extensions to right-click menus in Explorer.
Also, how can I write a VB application that allows plugins or extensions, much like Paint.NET?
Thanks for any help!
drummerboy0511
|
|
|
|
|
You can do it with VB.NET or C#, but with great difficulty. There is a ton of COM interop you have to setup in your code and a bunch of structures you have to create and marshal properly. On top of that, there's a bit of an issue with using managed code to write Shell extensions. You can read about that here[^]. It amy force you to write this in C++ instead.
Beyond that, try these[^] examples. Most of which is going to be C#, but can be converted to VB.NET with a little work.
|
|
|
|
|
Hi,
Actually I want to Communicate the DMM through the computer Comport. So I have created one MSComm control and did following setting and code.
Private Sub Form_Load()
MSComm1.Settings="9600,N,8,1"
MSComm1.CommPort=2
MSComm1.InputLen=0
MSComm1.PortOpen=True
MSComm1.Rthreshold =1
End Sub
I have send the *RST command to reset the DMM by the following code
Private Sub CmdSend_Click()
MSComm1.Output = "*RST"+Chr$(13)
End Sub
When I run this program, The DMM showing errors as -101, -102, -103. All these error are related to characters.
But, When I was running in Hyper terminal mode, DMM communication was perfect. Moreover, the DMM RS-232 setting (Baudrate and all) same as our computer setting. Still I could not communicating with DMM.
Pls help me to found out solution.
|
|
|
|
|
Well, somewhere, you've got at least one of the communication parameters wrong. It would be parity, handshaking, ..., any of them.
BTW, what's a "DMM"?
And if you're using Visual Studio 2005 or above, why are you using the old MsComm control instead of the SerialPort class in the .NET Framework?
|
|
|
|
|
Hi Dave,
the only DMM I know would be a Digital MultiMeter, an electronic device measuring voltages, currents, impedances, and the like. Handheld DMMs normally don't have a computer interface, desktop models often do, either a serial one or more often an IEEE-488 one (that is a rather old byte-wide bus for measurement equipment, not to be confused with IEEE-1394 aka FireWire).
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I figured that's what it was, but now-a-days, he could have been talking to a synthesizer or a toaster oven! I always ask just to make sure. You know what they say about "assume", right?
|
|
|
|
|
Dave Kreskowiak wrote: he could have been talking to a synthesizer or a toaster oven
I like a synthesizer with an interface, OTOH I wouldn't connect to a toaster.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Luc Pattyn wrote: OTOH I wouldn't connect to a toaster.
What?! You don't want to put a webcam in a toaster to get your English muffin's toasted to the perfect golden brown every time?
|
|
|
|
|
If the toaster contains a camera, that is OK, but I am not interested in those pictures. I want it to be smart enough to deliver on its promises all by itself. That is what embedded systems are supposed to do, not bother me, just deliver the results.
Now if the manufacturer needs an interface to service the device, he can do so; but again, I'm not interested in it. Oh wait, I might want to include it in my next domotica infrastructure. Have to rethink. If so, it won't be a serial port I'm afraid.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hi,
some guessing is required here.
your DMM probably wants some hardware handshaking (=data flow control), i.e. it needs you to set some control lines high or low, before it wants to listen to you (that would not explain the error conditions you mentioned);
or it wants you to not send stuff when it is not ready, as indicated by some control lines it is setting high or low.
I don't remember how handshaking and control lines work in Win32 or VB6; I do know for .NET
FYI: HyperTerminal by default chooses Hardware Handshake, Win32 does not. So try setting your COM port to hardware handshake.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
HI,
I AM POSTING SOME KB OF XML CONTENT TO WEBSERVER USING XMLHTTP. IT IS WORKING IN MY SYSTEM, IT IS SENDING AND RECEIVING DATA PROPERLY. BUT IN ONE OF MY CLIENTS SYSTEM IT IS NOT WORKING PROPERLY AND IT IS GIVING THE ERROR "The connection with the server was terminated abnormally".
IF ANYBODY HAVE AN IDEA PLS HELP US..
THANK YOU,
RISHI
WinCrs
|
|
|
|
|
I CANT HEAR YOU PROPERLY WHEN YOU SHOUT can you maybe talk a bit quieter.
Have you checked the various system/application error logs?
Have you checked the network stats for the dodgy client, is there high error rates?
Its a start.
|
|
|
|
|
thanks in advance
modified 28-Nov-12 4:47am.
|
|
|
|
|
You have to read the documentation on what these methods do (LTrim, Remove, SubString, ...). This is very simple string manipulation, and yes, Remove would be the way to go here.
|
|
|
|
|
Thanks for that reply...
will gothrough and comeback if i find something not working...
|
|
|
|
|