monoceres Posted September 4, 2008 Posted September 4, 2008 (edited) I have for a long time been irritated by the fact that Beep() doesn't return before finishing, so I wrote my own multi-threaded dll that plays the beep in another thread.Maybe it doesn't fit in "example scripts" but it may come in handy for someone!Here's the dll:http://monoceres.se/Uploads/Beep.dllThe exports looks like this:__declspec(dllexport) int BeepEx(DWORD dwFreq,DWORD dwDuration) __declspec(dllexport) BOOL IsBeeping()A small sample:$dll=DllOpen("Beep.dll") DllCall($dll,"int:cdecl","BeepEx","dword",200,"dword",1000) MsgBox(0,"","Beeeep!"); The beep will play while the msgbox is showing! DllClose($dll)Important!To not close the dll while a beep is playing, it will cause a crash!You can play a new beep however..PM me for the source, it's far too ugly display here Edited September 4, 2008 by monoceres Broken link? PM me and I'll send you the file!
Szhlopp Posted September 4, 2008 Posted September 4, 2008 I have for a long time been irritated by the fact that Beep() doesn't return before finishing, so I wrote my own multi-threaded dll that plays the beep in another thread. Maybe it doesn't fit in "example scripts" but it may come in handy for someone! Here's the dll: http://monoceres.se/Uploads/Beep.dll The exports looks like this: __declspec(dllexport) int BeepEx(DWORD dwFreq,DWORD dwDuration) __declspec(dllexport) BOOL IsBeeping() A small sample: $dll=DllOpen("Beep.dll") DllCall($dll,"int:cdecl","BeepEx","dword",200,"dword",1000) MsgBox(0,"","Beeeep!"); The beep will play while the msgbox is showing! DllClose($dll) Important! To not close the dll while a beep is playing, it will cause a crash! You can play a new beep however.. PM me for the source, it's far too ugly display here Very cool. This will be awesome for the games or anything else that you don't want to wait for beep to finish=) RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+'
Markos Posted September 5, 2008 Posted September 5, 2008 what about this one? Run(@AutoItExe & ' /AutoIt3ExecuteLine Beep()') MsgBox(0, Default, 'msgboox while beeping')
Andreik Posted September 5, 2008 Posted September 5, 2008 I have for a long time been irritated by the fact that Beep() doesn't return before finishing, so I wrote my own multi-threaded dll that plays the beep in another thread. Maybe it doesn't fit in "example scripts" but it may come in handy for someone! Here's the dll: http://monoceres.se/Uploads/Beep.dll The exports looks like this: __declspec(dllexport) int BeepEx(DWORD dwFreq,DWORD dwDuration) __declspec(dllexport) BOOL IsBeeping() A small sample: $dll=DllOpen("Beep.dll") DllCall($dll,"int:cdecl","BeepEx","dword",200,"dword",1000) MsgBox(0,"","Beeeep!"); The beep will play while the msgbox is showing! DllClose($dll) Important! To not close the dll while a beep is playing, it will cause a crash! You can play a new beep however.. PM me for the source, it's far too ugly display here Not working for me.
monoceres Posted September 5, 2008 Author Posted September 5, 2008 Not working for me. Does the normal Beep() work for you? It uses the same api. Broken link? PM me and I'll send you the file!
NELyon Posted September 5, 2008 Posted September 5, 2008 (edited) Uh oh. Autoit Hard Crashes for me. With your example code. Edited September 5, 2008 by KentonBomb
monoceres Posted September 5, 2008 Author Posted September 5, 2008 Uh oh. Autoit Hard Crashes for me. With your example code.Did you close the messagebox before the beep finished? If that's so then check the thing I wrote about closing the dll before beep is finished. Broken link? PM me and I'll send you the file!
NELyon Posted September 5, 2008 Posted September 5, 2008 Did you close the messagebox before the beep finished? If that's so then check the thing I wrote about closing the dll before beep is finished.The Message Box doesn't even show up. Autoit crashes as soon as the scripts starts.
monoceres Posted September 5, 2008 Author Posted September 5, 2008 The Message Box doesn't even show up. Autoit crashes as soon as the scripts starts.Weird, can you test add a msgbox() before the DllCall but after the DllOpen() and see if it crashes before or after? Broken link? PM me and I'll send you the file!
trancexx Posted September 5, 2008 Posted September 5, 2008 Weird, can you test add a msgbox() before the DllCall but after the DllOpen() and see if it crashes before or after?DllOpen is not working. It crashes before actual callCompile again ♡♡♡ . eMyvnE
NELyon Posted September 5, 2008 Posted September 5, 2008 Mah code: $dll=DllOpen("Beep.dll") ConsoleWrite("!>Dll Opened with handle " & $dll & @CRLF) DllCall($dll,"int:cdecl","BeepEx","dword",200,"dword",1000) ConsoleWrite("+>DLL Call... Happened" & @CRLF) MsgBox(0,"","Beeeep!"); The beep will play while the msgbox is showing! DllClose($dll) With the console output: >Running:(3.2.12.1):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\KentonBomb\My Documents\beep.au3" !>Dll Opened with handle -1 !>17:12:49 AutoIT3.exe ended.rc:-1073741819 So it seems to be breaking at the DLLCall because it did not open the DLL. I'll investigate.
monoceres Posted September 5, 2008 Author Posted September 5, 2008 DllOpen is not working. It crashes before actual call Compile again Mah code: With the console output: >Running:(3.2.12.1):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\KentonBomb\My Documents\beep.au3" !>Dll Opened with handle -1 !>17:12:49 AutoIT3.exe ended.rc:-1073741819 So it seems to be breaking at the DLLCall because it did not open the DLL. I'll investigate. I uploaded a fresh compile which worked great atm. Please try again Broken link? PM me and I'll send you the file!
trancexx Posted September 5, 2008 Posted September 5, 2008 (edited) not working for me works for you? that is strange Edited September 5, 2008 by trancexx ♡♡♡ . eMyvnE
monoceres Posted September 5, 2008 Author Posted September 5, 2008 not working for meworks for you? that is strangeI just got it!I compiled it in debug mode, that means that you will need the latest VC++ Redist.I compiled it again as "Release" now it should work!If not then the redist is probably needed:http://www.microsoft.com/downloads/details...;displaylang=en Broken link? PM me and I'll send you the file!
trancexx Posted September 5, 2008 Posted September 5, 2008 I just got it!I compiled it in debug mode, that means that you will need the latest VC++ Redist.I compiled it again as "Release" now it should work!If not then the redist is probably needed:http://www.microsoft.com/downloads/details...;displaylang=enyes, it worksso, gonna work on dlls now? ♡♡♡ . eMyvnE
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now