flat assembler
Message board for the users of flat assembler.
Index
> Windows > mciSendString |
Author |
|
typedef 17 May 2011, 05:38
hmmmm....i really never programmed with that api that much, but does the winmm.dll still stay in memory when your programm quits after calling ExitProcess?
maybe u shld add a message loop to see if that is the problem.... |
|||
17 May 2011, 05:38 |
|
typedef 17 May 2011, 05:40
also try defining the code section for clarity.
|
|||
17 May 2011, 05:40 |
|
me239 17 May 2011, 05:49
typedef wrote: hmmmm....i really never programmed with that api that much, but does the winmm.dll still stay in memory when your programm quits after calling ExitProcess? |
|||
17 May 2011, 05:49 |
|
mindcooler 17 May 2011, 06:11
Code: format PE console invoke Sleep,-1 _________________ This is a block of text that can be added to posts you make. |
|||
17 May 2011, 06:11 |
|
typedef 17 May 2011, 08:26
or
CreateWindowEx,0,WC_DIALOG SetWindowLong PeekMessge,,,PM_REMOVE TranslateMessage DispatchMessage and a procedure for handling the dlg. i can not help that much right now because im on my psp and typing on it is a daunting task |
|||
17 May 2011, 08:26 |
|
me239 17 May 2011, 20:19
I used the sleep, -1 and it worked, but I think I might try typedef's method. Also, does anyone know how to play the mp3 within the resource w/o making a temp file?
|
|||
17 May 2011, 20:19 |
|
typedef 17 May 2011, 22:04
Yeah I remember there's is a way of extracting it from resource directory during runtime and then playing it...
|
|||
17 May 2011, 22:04 |
|
me239 18 May 2011, 04:33
Hey, I just had a crazy idea. Can I register the mciSendString command to another process so my program just executes the command, but leaves it with something like explorer.exe?
|
|||
18 May 2011, 04:33 |
|
me239 18 May 2011, 05:03
I just found a quicker way than the sleep command. Use "Play Mp3 wait" instead of "Play Mp3 from 0". The wait forces the application to wait as long as the song lasts and then can allow you to exit.
|
|||
18 May 2011, 05:03 |
|
goldenspider 10 Jun 2011, 04:56
Share the code.
Code: ;---------------------------------------------------------- ; Program Name: playmp3.asm ; Purpose : plays an mp3 file ; Date : August 2008 ; Author : Yeoh HS ; FASM : Built using Flat Assembler version 1.67.27 ; edited and compiled with FASM's IDE. ;---------------------------------------------------------- format PE CONSOLE 4.0 entry start include 'win32axp.inc' .data CRLF db '',13,10,0 ; carriage return and linefeed cmd_open db 'open explosion.mp3 type MPEGVideo Alias MP3',0 cmd_play db 'play MP3',0 cmd_close db 'close MP3',0 nullstring db '',0 .code start: invoke mciSendString, cmd_close, nullstring, 0, 0 invoke mciSendString, cmd_open, nullstring, 0, 0 invoke mciSendString, cmd_play, nullstring, 0, 0 cinvoke printf, CRLF cinvoke printf, 'Press the Enter key...' cinvoke getchar invoke ExitProcess,0 section '.idata' import data readable writeable library kernel32,'kernel32.dll',\ user32, 'user32.dll',\ winmm, 'winmm.dll',\ msvcrt, 'msvcrt.dll' include 'api\kernel32.inc' include 'api\user32.inc' import winmm,\ mciSendString, 'mciSendStringA' import msvcrt,\ printf, 'printf',\ getchar,'getchar' ; end of file |
|||
10 Jun 2011, 04:56 |
|
me239 10 Jun 2011, 05:08
goldenspider wrote: Share the code. Here is the one I made a few weeks ago Code: format PE GUI 4.0 include 'win32a.inc' start: invoke mciSendString, close, 0, 0 invoke mciSendString, opcom, 0, 0 invoke mciSendString, play, 0, 0 invoke ExitProcess, 0 section '.data' data readable writeable close db "Close Mp3",0 opcom db "Open C:\test.MP3 Alias Mp3",0 play db "Play C:\test.mp3 wait",0 section '.idata' import data readable writeable library kernel32, "KERNEL32.DLL",\ winmm, "WINMM.DLL" import kernel32,\ ExitProcess, "ExitProcess" import winmm,\ mciSendString, "mciSendStringA" |
|||
10 Jun 2011, 05:08 |
|
catafest 18 May 2017, 18:34
I try it just run first time then the source code don't want to be compile on next change. This is strange !
see my changes: Code: close db "Close C:\FASM\testing.Mp3",0 opcom db "Open C:\FASM\testing.Mp3 Alias Mp3",0 play db "Play C:\FASM\testing.Mp3 wait",0 me239 wrote: Hello! Today I was trying to make a mp3 player using the native mci, but haven't had much luck. Here is my code: |
|||
18 May 2017, 18:34 |
|
revolution 18 May 2017, 22:09
catafest wrote: I try it just run first time then the source code don't want to be compile on next change. This is strange ! Code: format PE GUI 4.0 include 'win32a.inc' section '.code' readable executable start: invoke mciSendString, close, 0, 0 invoke mciSendString, opcom, 0, 0 invoke mciSendString, play, 0, 0 invoke Sleep, -1 section '.data' data readable writeable close db "Close C:\FASM\testing.Mp3",0 opcom db "Open C:\FASM\testing.Mp3 Alias Mp3",0 play db "Play C:\FASM\testing.Mp3 wait",0 section '.idata' import data readable writeable library kernel32, "KERNEL32.DLL",\ winmm, "WINMM.DLL" import kernel32,\ Sleep, "Sleep" import winmm,\ mciSendString, "mciSendStringA" |
|||
18 May 2017, 22:09 |
|
catafest 19 May 2017, 14:35
This error , see screenshot http://imgur.com/egrgEpH
First time is compile and run well the second time I got this error . revolution wrote:
|
|||
19 May 2017, 14:35 |
|
revolution 20 May 2017, 00:28
Write failed mean the program is still running. You will have terminate it before you can overwrite the .exe file.
Maybe use ExitProcess instead of Sleep? I haven't tried it. But unless it terminates you will always have this problem. |
|||
20 May 2017, 00:28 |
|
catafest 20 May 2017, 12:05
+1 revolution
Thank you. Yes is Sleep over FASM compile, also the task is not show into Task Manager. revolution wrote: Write failed mean the program is still running. You will have terminate it before you can overwrite the .exe file. |
|||
20 May 2017, 12:05 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.