473,657 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mciSendString - length of a track

HI

The mciSendString returns different value of tracks length than
winamp. The value is longer about 20 seconds and I don't know why.
Here is a code:

public void SetTime() // I tried to set time format as it is said in
MSDN help but it dosent work
{
sCommand = "set MediaFile time format hms";
mciSendString(s Command, null, 0, IntPtr.Zero);
}
public int TrackLength()
{
Open(pathPlay); // here I open file (with whole path)
which length should be checked
//SetTime();
sCommand = "status MediaFile length";
int i = 128;
System.Text.Str ingBuilder stringBuilder = new
System.Text.Str ingBuilder(i);
mciSendString(s Command, stringBuilder, i,
IntPtr.Zero);
return System.Convert. ToInt32(stringB uilder.ToString ());
}

The value is returned in ms. Any ideas?? Or maybe I should use
different function to check the length??
Here is the link which help me a lot:
http://msdn.microsoft.com/library/de..._status_mm.asp

KK

Jun 8 '07 #1
1 7027
Hi,

I suggest that you post this question in one of the WM SDK forums.
"_nabuchodonozo r" <kk******@wsb-nlu.edu.plwrote in message
news:11******** ************@e6 5g2000hsc.googl egroups.com...
HI

The mciSendString returns different value of tracks length than
winamp. The value is longer about 20 seconds and I don't know why.
Here is a code:

public void SetTime() // I tried to set time format as it is said in
MSDN help but it dosent work
{
sCommand = "set MediaFile time format hms";
mciSendString(s Command, null, 0, IntPtr.Zero);
}
public int TrackLength()
{
Open(pathPlay); // here I open file (with whole path)
which length should be checked
//SetTime();
sCommand = "status MediaFile length";
int i = 128;
System.Text.Str ingBuilder stringBuilder = new
System.Text.Str ingBuilder(i);
mciSendString(s Command, stringBuilder, i,
IntPtr.Zero);
return System.Convert. ToInt32(stringB uilder.ToString ());
}

The value is returned in ms. Any ideas?? Or maybe I should use
different function to check the length??
Here is the link which help me a lot:
http://msdn.microsoft.com/library/de..._status_mm.asp

KK

Jun 8 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3988
by: Jeroen van Vliet | last post by:
I made a program where wav files will be played from the database, with the full path.LIKE i = mciSendstring(open d:\sound.wav type waveaudio",0&,0,0) i = mciSendstring(play d:\sound.wav ",0&,0,0) This program will be written on a cdrom, in this case ithe cdrom volume is D: , but on other systems its not. How do i let the program choose the right volume?
3
4970
by: Mark Denardo | last post by:
Does anyone have any good VB.NET example code that shows how to use the NOTIFY option using the mciSendString API and then handle the return value. The only examples I can find show the VB way using <Form>.hWnd My program basically needs to start a media file and then be informed when it has finished. Right now I have to set up a polling thread to check the status of the playing media file, which works, but causes other parts of my...
0
1421
by: kbodily | last post by:
Hi, I have this code in a dragdrop routine for a listview to get the duration of an mp3, where fPath is the path to the file that gets dropped Dim fname As String = Chr(34) + Trim(fPath) + Chr(34) mciSendString("open " & fname & " alias song", 0, 0, 0) Dim totalTime As String = Space(128) mciSendString("status song length", totalTime, 128, 0&) .Duration = totalTime
1
6904
by: =?Utf-8?B?Q8Opc2Fy?= | last post by:
Could anyone tell me what am i doing bad? When i use the "MciSendString" always returns a big number instead 0 : What it says that there is an error, and so don't play the sound. Then direction of the sound .wav it's ok I must not use any .ocx. Could anyone compile it and tell me what it's wrong?
1
5483
by: _nabuchodonozor | last post by:
Hi, I use MCI to play mp3 tracks. I wrote very simple player where I put the path to mp3 files and press the button play. Everything works excellent but I want to make my player better and know the length of a track to show current position of the track on the TrackBar. I imported : private static extern long mciSendString(string strCommand, StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback);
1
1764
by: bajunaid | last post by:
Hi.. I'm trying to use mciSendString to play MP3 files and record WAV using mciSendString.. I did it successfully in a C# windowsApplicaton.. But when I move the same cod to my ASP file.. It just doesn't work.. I am using VS2005.. and I dont know what is the problem.. I have no errors,, it just doesn't work..
0
1830
by: nodoid | last post by:
Hi, I'm using the code (roughly) from http://www.dotnetmonster.com/Uwe/Forum.aspx/dotnet-csharp/92578/Playing-an-avi-file-in-a-C-app to send a video to a picturebox (in this case, it's an mpeg file). My code looks like this public class video {
0
1688
by: samvb | last post by:
Hi, I have picpreview which is visiable and dimension set to more than 0. it is in pixels. When trying this code, nothing shows up. Not in the picpreview (the video i mean) nor in its own window. What could be the problem? 'public Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long...
1
3880
by: nagarajr | last post by:
prototype for mciSendString,sleep,beep. unable to open include windows.h,mmsystem.h error. is this syntax correct using namespace std; #include <iostream> #include <windows.h> // Sleep() #include <mmsystem.h> // mciSendString() using namespace std; // std::cout, std::cin int main()
0
8384
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8302
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8820
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8718
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5630
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1937
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.