473,320 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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(sCommand, 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.StringBuilder stringBuilder = new
System.Text.StringBuilder(i);
mciSendString(sCommand, stringBuilder, i,
IntPtr.Zero);
return System.Convert.ToInt32(stringBuilder.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 6998
Hi,

I suggest that you post this question in one of the WM SDK forums.
"_nabuchodonozor" <kk******@wsb-nlu.edu.plwrote in message
news:11********************@e65g2000hsc.googlegrou ps.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(sCommand, 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.StringBuilder stringBuilder = new
System.Text.StringBuilder(i);
mciSendString(sCommand, stringBuilder, i,
IntPtr.Zero);
return System.Convert.ToInt32(stringBuilder.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
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...
3
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...
0
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) +...
1
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...
1
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...
1
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...
0
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...
0
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....
1
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() ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.