flat assembler
Message board for the users of flat assembler.
Index
> Windows > How to play audio files under windows ? Goto page 1, 2 Next |
Author |
|
cod3b453 09 Jan 2013, 22:03
I'm not sure but I think this can be done the with waveOutxxxx API (Sorry, I've never used it)
|
|||
09 Jan 2013, 22:03 |
|
edfed 10 Jan 2013, 12:55
|
|||
10 Jan 2013, 12:55 |
|
shutdownall 10 Jan 2013, 17:35
edfed wrote: http://board.flatassembler.net/topic.php?t=5086 It does use the same PlaySound / mciSendString. With PlaySound you can play a sound in the background but not with simple start/stop/replay commands and progress bar. I could use wmplayer with parameters but more nice would be a really simple player which could be delivered with my software. So if anybody know a simple player not to big, possibly 1-exe-only-file - would be nice. |
|||
10 Jan 2013, 17:35 |
|
typedef 10 Jan 2013, 18:56
shutdownall wrote:
http://libzplay.sourceforge.net/WELCOME.html I've always used this one. Supports graphs, volume and updates, just import from the dll in this case. It's very easy to use. |
|||
10 Jan 2013, 18:56 |
|
shutdownall 10 Jan 2013, 19:27
typedef wrote:
Thanks, will try it out soon. |
|||
10 Jan 2013, 19:27 |
|
shadowomf 12 Jan 2013, 15:35
You can also try OpenAL, in case you want to use surround sound in the future.
|
|||
12 Jan 2013, 15:35 |
|
nmake 12 Jan 2013, 19:49
You could write your own directsound wrapper library. I made a wrapper library dll a few years back using a different assembler. You can load single wave files individually or load many wave files in a single load, I made a tool to merge wave files into a single binary file. Plays sounds very easily, you can adjust panning, volume, frequency etc very easily. I am planning to convert the library to fasm. It is some 1300 lines of assembly code. Much better than the PlaySound function.
|
|||
12 Jan 2013, 19:49 |
|
shutdownall 13 Jan 2013, 00:32
typedef wrote:
I tried it out today but not with much success. First problem is, that it does not recognize my created WAV format. But this is valid RIFF format, just have own sample rate of exactly 30.000 Hz. It does play the file when I explicitly select the PCM format but it does not play properly. Too fast (double or 3 times faster) and not like it should be played. Every other player (PlaySound, wmPlayer, VLC player and so on) play this file properly with no problem at all. The second part is, I did not found any function for displaying a real visible player out of the box with this package. I just can call some play functions in the background and there is no big difference to PlaySound except some more options and formats to choose. Code: invoke MessageBox,[hwnd],load_msg,_find,MB_ICONINFORMATION+MB_OK invoke ZPlayCreate mov [ZPlayInst],eax or eax,eax jnz @f invoke MessageBox,[hwnd],_load_error,_caption,MB_ICONINFORMATION+MB_OK @@: invoke ZPlayOpenFile,[ZPlayInst],.file,4 or eax,eax jnz @f invoke ZPlayGetError,[ZPlayInst] invoke MessageBox,[hwnd],eax,_caption,MB_ICONINFORMATION+MB_OK @@: invoke ZPlayPlay,[ZPlayInst] |
|||
13 Jan 2013, 00:32 |
|
shutdownall 13 Jan 2013, 00:40
shadowomf wrote: You can also try OpenAL, in case you want to use surround sound in the future. These seem to be same as the proposal from typedef to be an API only. I am looking for a complete, small player for audio files with a few controls and a progress bar, displayed in a new window. Not an API with functions only ! If I would use an API I could use the PlaySound function from Windows. I don't want to program the graphics. |
|||
13 Jan 2013, 00:40 |
|
shutdownall 13 Jan 2013, 22:40
I now found a way to open the audio file with the default audio player assigned to .wav extension with cmd.exe and CreateProcess.
Code: invoke CreateProcess,NULL,play_string,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,playsinfo,playpinfo There is still one problem, the cmd.exe leaves a not nice cmd window when starting my player (VLC) first time (see picture). When I start it second time (first process will be killed first), the cmd windows is not seen again, only the media player started new but this is in the background. Code: invoke TerminateProcess,[playpinfo.hProcess],-1 invoke CreateProcess,NULL,play_string,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,playsinfo,playpinfo So my questions are now: 1. Is there another way to start it without cmd.exe ? For example I can simply execute the .WAV file while entering the filename in windows "execute" input. So I can execute simply the TEST.WAV under Windows and Windows execute it with the assigned program. This does not work with CreateProcess, this work only with executing the command line: Code: C:\windows\system32\cmd.exe /c TEST.WAV 2. Is there a way to get a focus on the executed process ? The first time, the WAV player is shown including the cmd window. If I end it with TerminateProcess and start a new process, the cmd window is not seen again and the media player is executed but not focused. 3. Is there a way to get the process as a child window ? 4. Is there an easy way to get the path to cmd.exe for running an every computer ? Did not program too much under Windows, so maybe some questions are maybe simple.
Last edited by shutdownall on 13 Jan 2013, 22:52; edited 2 times in total |
||||||||||
13 Jan 2013, 22:40 |
|
HaHaAnonymous 13 Jan 2013, 22:47
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 21:59; edited 1 time in total |
|||
13 Jan 2013, 22:47 |
|
shutdownall 13 Jan 2013, 22:53
HaHaAnonymous wrote:
Okay - how can I do that ? |
|||
13 Jan 2013, 22:53 |
|
HaHaAnonymous 13 Jan 2013, 23:51
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 21:59; edited 2 times in total |
|||
13 Jan 2013, 23:51 |
|
typedef 14 Jan 2013, 03:32
Here try this.
|
|||||||||||
14 Jan 2013, 03:32 |
|
shutdownall 14 Jan 2013, 13:50
typedef wrote: Here try this. Thanks, I just tried it out. It works but there is the progress bar missing. And you are using the PlaySound in similar way than me before. Okay the dialog I didn't have. If you want to program the progress bar (0-100%) too, feel free. But I don't want you to make too much work for you. If you could give me an example to set a focus on a newly created process and/or make it as child windows would be sufficient. Up to you. |
|||
14 Jan 2013, 13:50 |
|
shutdownall 14 Jan 2013, 20:15
So have partly success while hiding system cmd.exe window over startupinfo structure.
New opened window is top on desktop, at least first time. If I close the window and start running my request again, it's created new with position on top. If I put the window back but leaving running, it remains in the background even if it old process is terminated and new process started: Code: mov [playsinfo.cb],sizeof.STARTUPINFO mov [playsinfo.lpTitle],player_buffer mov [playsinfo.wShowWindow],0 mov [playsinfo.dwFlags],1 invoke TerminateProcess,[playpinfo.hProcess],0 invoke WaitForSingleObject,[playpinfo.hProcess],1000 invoke CreateProcess,NULL,player_buffer,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,playsinfo,playpinfo So far so good. I would like to have a chance to get the windows handle, to switch it to the foreground to seen on top when I start the function second or third time. The problem: I don't have the window handle. I don't have the window title. The title is set but only valid for the cmd.exe window which starts a new process with the player. As I don't know what's the default player in the system (VLC, Windows Mediaplayer or some other) I can not search with FindWindow. And I don't have the process ID as the cmd.exe starts a new process. So I have the process ID of cmd.exe, need to find the sub process ID of the started player and then have to find the window handle of this sub process main window. What's the best way ? Any suggestions in code examples would be nice. I tried Mark Russinovich's "Handle v3.5" tool to find all informations about any handles in the system and found that out, a new child process started. info about the cmd.exe Code: cmd.exe pid: 4696 PC\User 4: Directory \KnownDlls 8: File (RW-) C:\Develop\99\SOURCE\IDE\FASMW C: Event 10: ALPC Port 14: ALPC Port 18: Key HKLM\SYSTEM\ControlSet001\Control\Nls\Sorting\Versions 1C: Key HKLM\SYSTEM\ControlSet001\Control\Session Manager 20: EtwRegistration 24: Event 28: WindowStation \Sessions\1\Windows\WindowStations\WinSta0 2C: Desktop \Default 30: WindowStation \Sessions\1\Windows\WindowStations\WinSta0 34: Key HKLM 38: Thread cmd.exe(4696): 4196 3C: Mutant 40: Event 44: File (---) \FileSystem\Filters\FltMgrMsg 48: Key HKCU 4C: Key HKLM\SYSTEM\ControlSet001\Control\Nls\Locale 50: Key HKLM\SYSTEM\ControlSet001\Control\Nls\Locale\Alternate Sorts 54: Key HKLM\SYSTEM\ControlSet001\Control\Nls\Language Groups 58: EtwRegistration 5C: EtwRegistration 60: EtwRegistration 64: EtwRegistration 68: EtwRegistration 6C: EtwRegistration 70: EtwRegistration 74: File (RW-) C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2 78: EtwRegistration 7C: EtwRegistration 80: Section \Sessions\1\BaseNamedObjects\windows_shell_global_counters 84: Directory \Sessions\1\BaseNamedObjects 8C: EtwRegistration 94: Event 98: Event 9C: Event A0: Event A4: Event A8: Event B4: File (---) \Device\KsecDD BC: EtwRegistration C0: EtwRegistration C4: ALPC Port C8: Section CC: EtwRegistration D0: EtwRegistration D4: Key HKCU D8: Key HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer E0: Key HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts E8: Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}\PropertyBag EC: Event \KernelObjects\MaximumCommitCondition F0: Section \BaseNamedObjects\__ComCatalogCache__ F4: Section \BaseNamedObjects\windows_shell_global_counters F8: EtwRegistration FC: EtwRegistration 100: Event 104: Semaphore 108: Semaphore 10C: Semaphore 110: Semaphore 114: Semaphore 118: Semaphore 11C: Semaphore 120: Semaphore 124: Section \BaseNamedObjects\C:*ProgramData*Microsoft*Windows*Caches*{6AF0698E-D558-4F6E-9B3C-3716689AF493}.2.ver0x000000000000000b.db 128: Section \BaseNamedObjects\C:*ProgramData*Microsoft*Windows*Caches*cversions.2.ro 12C: Section \BaseNamedObjects\C:*ProgramData*Microsoft*Windows*Caches*cversions.2.ro 130: Section \BaseNamedObjects\C:*ProgramData*Microsoft*Windows*Caches*{DDF571F2-BE98-426D-8288-1A9A39C3FDA2}.2.ver0x0000000000000002.db 138: Section \Sessions\1\BaseNamedObjects\windows_shell_global_counters 148: TpWorkerFactory 14C: IoCompletion 150: TpWorkerFactory 154: TpWorkerFactory 158: TpWorkerFactory 15C: EtwRegistration 160: Event 164: Event 168: EtwRegistration 16C: Mutant 170: Event 174: Mutant 178: Event 17C: Event 180: Event 184: EtwRegistration 188: EtwRegistration 18C: Event 190: Thread cmd.exe(4696): 4144 194: ALPC Port 1A8: Key HKCU\Software\Microsoft\Windows NT\CurrentVersion 1AC: Key HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags 1B0: Key HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options 1B4: Process vlc.exe(2848) 1C4: EtwRegistration and this is information about the player, in my case VLC Code: vlc.exe pid: 2848 PC\User 4: Directory \KnownDlls 8: File (RW-) C:\Develop\99\SOURCE\IDE\FASMW C: Key HKLM\SYSTEM\ControlSet001\Control\Nls\Sorting\Versions 10: Mutant 14: ALPC Port 18: Key HKLM 1C: Event 20: Key HKLM\SYSTEM\ControlSet001\Control\Session Manager 24: EtwRegistration 28: Event 2C: WindowStation \Sessions\1\Windows\WindowStations\WinSta0 30: Desktop \Default 34: WindowStation \Sessions\1\Windows\WindowStations\WinSta0 38: EtwRegistration 3C: File (---) \FileSystem\Filters\FltMgrMsg 40: EtwRegistration 44: EtwRegistration 48: EtwRegistration 4C: EtwRegistration 50: EtwRegistration 54: EtwRegistration 58: EtwRegistration 5C: Event 60: Event 64: Event 68: Event 6C: EtwRegistration 70: Event 74: Event 78: Event 7C: Event 80: Event 84: Event 88: Directory \Sessions\1\BaseNamedObjects 8C: EtwRegistration 90: EtwRegistration 94: Key HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer 98: Section \Sessions\1\BaseNamedObjects\windows_shell_global_counters 9C: Key HKCU A0: Event A4: EtwRegistration A8: Thread vlc.exe(2848): 4420 AC: Event B0: Key HKLM\SYSTEM\ControlSet001\services\WinSock2\Parameters\Protocol_Catalog9 B4: Event B8: Key HKLM\SYSTEM\ControlSet001\services\WinSock2\Parameters\NameSpace_Catalog5 BC: Event C0: Event C4: Event C8: Event CC: Mutant \Sessions\1\BaseNamedObjects\VLC ipc 2.0.4 D0: Event D4: Event D8: Thread vlc.exe(2848): 2796 DC: Event E0: File (RW-) C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2 E4: EtwRegistration E8: EtwRegistration EC: Mutant F0: Mutant F4: EtwRegistration F8: EtwRegistration FC: ALPC Port 100: Section 104: EtwRegistration 108: EtwRegistration 10C: Thread vlc.exe(2848): 3044 110: Event 114: Event 118: Event 11C: Event 120: Event 124: File (R-D) C:\Windows\System32\de-DE\KernelBase.dll.mui 128: Thread vlc.exe(2848): 2840 12C: Event 130: Event 134: Event 138: Event 13C: Event 140: Event 144: Event 148: EtwRegistration 14C: EtwRegistration 150: EtwRegistration 154: EtwRegistration 158: EtwRegistration 15C: EtwRegistration 160: EtwRegistration 164: Event 168: Event 16C: Event 170: Event 174: Event 178: Thread vlc.exe(2848): 1404 17C: Event 180: Event 184: Event 188: Event 18C: Event 190: Event 194: Event 198: Event 19C: File (---) \Device\KsecDD 1A0: Event 1A4: Event 1A8: Event 1AC: Event 1B0: Event 1B4: Event 1B8: Event 1BC: EtwRegistration 1C0: EtwRegistration 1C4: EtwRegistration 1C8: Event 1CC: Event 1D0: Event 1D4: Event 1D8: Event 1DC: Event 1E0: Event 1E4: Event 1E8: Event 1EC: Event 1F0: Event 1F4: Event 1F8: Event 1FC: Event 200: Event 204: Event 208: Event 20C: Event 210: Event 214: Event 218: Event 21C: Event 220: Event 224: Event 228: Event 22C: Event 230: Event 234: Event 238: Event 23C: Event 240: Event 244: Event 248: Event 24C: Event 250: Event 254: Event 258: Event 25C: Event 260: Event 264: Event 268: Event 26C: Event 270: Event 274: Event 278: Event 27C: Event 280: Event 284: Event 288: Event 28C: Event 290: Event 294: Event 298: Event 29C: Event 2A0: Event 2A4: Event 2A8: Event 2AC: Event 2B0: Event 2B4: Event 2B8: Event 2BC: Event 2C0: Event 2C4: Event 2C8: Event 2CC: Event 2D0: Event 2D4: Event 2D8: Event 2DC: Event 2E0: Event 2E4: Event 2E8: Event 2EC: Event 2F0: Event 2F4: Event 2F8: Event 2FC: Event 300: Event 304: Event 308: Event 30C: Event 310: Event 314: Event 318: Event 31C: Event 320: Event 324: Event 328: Event 32C: Event 330: Event 334: Event 338: Event 33C: EtwRegistration 340: EtwRegistration 344: Event 348: Thread vlc.exe(2848): 1404 34C: ALPC Port 350: IoCompletion 354: TpWorkerFactory 358: TpWorkerFactory 35C: TpWorkerFactory 360: TpWorkerFactory 364: KeyedEvent 368: Timer 36C: Timer 370: Thread vlc.exe(2848): 1248 374: Thread vlc.exe(2848): 1248 378: IoCompletion 37C: TpWorkerFactory 380: TpWorkerFactory 384: TpWorkerFactory 388: TpWorkerFactory 38C: Timer 390: ALPC Port 394: Event 398: EtwRegistration 39C: ALPC Port \RPC Control\OLE7A14CA2A2DA841738C928FD5B7AA 3A0: Thread vlc.exe(2848): 3228 3A4: Event 3A8: ALPC Port 3AC: Event 3B0: Thread vlc.exe(2848): 3152 3B4: Event 3B8: Event 3BC: Event 3C0: Key HKLM\SYSTEM\ControlSet001\Control\Nls\Locale 3C4: Key HKLM\SYSTEM\ControlSet001\Control\Nls\Locale\Alternate Sorts 3C8: Key HKLM\SYSTEM\ControlSet001\Control\Nls\Language Groups 3CC: File (R-D) C:\Windows\Fonts\StaticCache.dat 3D0: Section 3D4: Event 3D8: Event 3DC: Event 3E0: Event 3E4: Event 3E8: Event 3EC: Event 3F0: Event 3F4: Event 3F8: Event 3FC: Event 400: Event 404: Event 408: Event 40C: Event 410: Event 414: Event 418: Event 41C: Event 420: Event 424: Event 428: Event 42C: Event 430: Event 434: Event 438: Event 43C: Event 440: Event 444: Event 448: Event 44C: Event 450: Event 454: Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\PropertyBag 458: Event 45C: Event 460: ALPC Port 464: Mutant \Sessions\1\BaseNamedObjects\MSCTF.Asm.MutexDefault1 468: Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{FDD39AD0-238F-46AF-ADB4-6C85480369C7}\PropertyBag 46C: Event 470: Event 474: Event 478: Thread vlc.exe(2848): 5836 47C: Event 480: File (RW-) C:\Develop\99\SOURCE\IDE\FASMW\002.wav 484: Event 488: Event 48C: Event 490: Event 494: Event 498: Event 49C: Section \BaseNamedObjects\__ComCatalogCache__ 4A0: Key HKCU 4A4: Event \KernelObjects\MaximumCommitCondition 4A8: Section \BaseNamedObjects\__ComCatalogCache__ 4AC: EtwRegistration 4B0: EtwRegistration 4B4: EtwRegistration 4B8: EtwRegistration 4BC: EtwRegistration 4C0: File (RW-) C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2 4C4: Event 4C8: Event 4CC: Thread vlc.exe(2848): 4772 4D0: Event 4D4: Event 4D8: Event 4DC: Event 4E0: Event 4E4: EtwRegistration 4E8: Event 4EC: EtwRegistration 4F0: Mutant 4F4: Event 4F8: Mutant 4FC: EtwRegistration 500: EtwRegistration 504: Mutant 508: EtwRegistration 50C: EtwRegistration 510: EtwRegistration 514: Event 518: Event 51C: Mutant 520: Event 524: Mutant 528: Event 52C: Thread vlc.exe(2848): 4772 530: ALPC Port 534: Event 538: Mutant 53C: ALPC Port 540: Mutant 544: Mutant \Sessions\1\BaseNamedObjects\DirectSound Administrator shared thread array (lock) 548: Section \Sessions\1\BaseNamedObjects\DirectSound Administrator shared thread array 54C: Event 550: Event 554: Thread vlc.exe(2848): 4656 558: Event 55C: Event 560: Thread vlc.exe(2848): 4656 564: EtwRegistration 568: EtwRegistration 56C: EtwRegistration 570: ALPC Port 574: Event 578: Thread vlc.exe(2848): 3904 57C: Event 580: Event 584: Thread vlc.exe(2848): 3904 588: ALPC Port 58C: Thread vlc.exe(2848): 3904 590: Event 594: Event 598: EtwRegistration 59C: ALPC Port 5A0: Event 5A4: Key HKLM\SYSTEM\ControlSet001\Control\MediaResources\DirectSound 5A8: Event 5AC: Thread vlc.exe(2848): 5644 5B0: Event 5B4: Thread vlc.exe(2848): 1520 5B8: Event 5BC: Event 5C0: Event 5C4: Event 5C8: Event 5CC: Event 5D0: Event 5D4: Event 5D8: Thread vlc.exe(2848): 1520 5DC: Section 5E0: Event 5E4: Event 5E8: Event 5EC: Event 5F0: Event 5F4: Event 5F8: Thread vlc.exe(2848): 4648 5FC: ALPC Port 600: Event Last edited by shutdownall on 14 Jan 2013, 20:20; edited 1 time in total |
|||
14 Jan 2013, 20:15 |
|
shutdownall 14 Jan 2013, 20:20
I just found in my post, that both processes have a "file handle" pointing to my program which started the process (directory of FASMW).
Would this be a convenient way ? Code: 8: File (RW-) C:\Develop\99\SOURCE\IDE\FASMW |
|||
14 Jan 2013, 20:20 |
|
shutdownall 16 Jan 2013, 12:04
There are several ways of finding windows but most of them are very complicate and not suitable. For example EnumWindows does not help very much as the opened player does not belong to my application as it is started with "cmd".
I found it out with procexp.exe (Proc Explorer) from Mark Russinovich. There is the possibility to search a thread which has a file handle to my datafile with a in-build search function by passing a string to this search function which can be a part name of my file. There are same examples how to do that in the internet but I think this is much overhead. By the way, I found out that I could not start wmplayer.exe directly (then I would have the process number). Maybe a security issue from Windows. The path to wmplayer is correct and I can start any other program or player from Windows. So to use a player (by the way any player) I use the association of file extensions to programs so that I simply execute my WAV file and let Windows look for the program. That works with all players and the user can easily change that without defining names or pathes to players. So this is executed Code: C:\WINDOWS\SYSTEM32\CMD.EXE /C AUDIOFILE.WAV The Path to Windows is determined by a function. Here is the complete code: Code: invoke GetSystemDirectory,process_buffer,200h ; get path to system32 directory mov esi,process_buffer mov byte [esi+200h],0 @@: lodsb cmp al,0 ; find end of path jne @b dec esi mov edi,esi mov al,'\' stosb mov esi,cmd_name ; add program to execute (cmd.exe) .loop: lodsb stosb cmp al,0 jne .loop dec edi mov eax,' /c ' ; add parameter "/c" stosd mov esi,wav_filename @@: lodsb stosb cmp al,0 jne @b mov [playsinfo.cb],sizeof.STARTUPINFO mov [playsinfo.wShowWindow],0 ; this prevent the cmd "dos box" from appearing to screen mov [playsinfo.dwFlags],1 invoke CreateProcess,NULL,process_buffer,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,playsinfo,playpinfo invoke Sleep,2000 ; wait for process to be initialized invoke GetForegroundWindow ; get handle to the player, opened on top of application mov [hwndplayer],eax ; store this handle for closing from application later So I wait about 2 seconds to get the player started and then determine the ForegroundWindow. With that handle it is easy to do some action to this window and can be even closed simply from application. For closing it does not work with WM_DESTROY as it is not allowed to send to foreign applications. For closing later I do following trick: Code: close_player: mov eax,[hwndplayer] or eax,eax jz @f invoke SetForegroundWindow,eax invoke Sleep,100 invoke keybd_event,0x12,0xb8,0,0 invoke keybd_event,0x73,0xbe,0,0 invoke keybd_event,0x73,0xbe,2,0 invoke keybd_event,0x12,0xb8,2,0 @@: retn I set the window to foreground so it gets the focus and paste the keystroke for ALT-F4 (found in internet) in the keyboard buffer where it is processed from the active application. That works quite good. As long somebody avoid wild clicking around during this 2 seconds and bring some other window to the top but for me it is an acceptable 99% solution. |
|||
16 Jan 2013, 12:04 |
|
shutdownall 17 Jan 2013, 09:38
shutdownall wrote:
I changed the call and put the filename into "" for supporting spaces in directory names. Code: C:\WINDOWS\SYSTEM32\CMD.EXE /C "AUDIOFILE.WAV" By the way - this could be maybe the issue why program is not run directly. There are also spaces in directory name "Windows Media Player". So could try to put all into "". But I didn't check it. Maybe this could work: Code: "C:\WINDOWS\PROGRAMS\WINDOWS MEDIA PLAYER\WMPLAYER.EXE AUDIOFILE.WAV" |
|||
17 Jan 2013, 09:38 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.