The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: KcDan on August 14, 2005, 01:20:40 AM

Title: Turning a string into a number.
Post by: KcDan on August 14, 2005, 01:20:40 AM
Im currently working on a Media Player and Im using mciSendString to display and control the media.

An important part of my program involves getting the length of the media file loaded by using the command string 'status movie length'.

Data

TotalLengthMP db 'status movie length',0
TotalLength dd 257 dup (0)


Code

LOCAL TotalLength:DWORD
invoke mciSendString,addr TotalLengthMP,addr TotalLength,sizeof TotalLength,0


How can I get the number thats in TotalLength and put it in TotalLength?
Title: Re: Turning a string into a number.
Post by: Mark Jones on August 14, 2005, 04:07:47 PM
Hi Dan. What specifically are you trying to do, your discription is a little ambiguous. Maybe this will help:


; lets say that StatusMovieLength is ASCII "123456",0
    invoke mciSendString,addr TotalLengthMP,addr StatusMovieLength,sizeof TotalLength,0
    invoke atodw,addr StatusMovieLength ; returns eax (0x1E240)
; use eax or copy its value somewhere
Title: Re: Turning a string into a number.
Post by: KcDan on August 14, 2005, 06:42:22 PM
Sorry about my post, I was quite tired when I made it. Also thanks for the solution to my problem.
Title: Re: Turning a string into a number.
Post by: Mark Jones on August 14, 2005, 06:52:54 PM
Hehe, don't feel bad. I've done much worse... :toothy

http://www.masmforum.com/simple/index.php?topic=2351.0