In other words you haven't tried...
Read the manual, it's pretty straight forward. It's not going to teach you C, it will tell you how to use the API though.
In other words you haven't tried...
Read the manual, it's pretty straight forward. It's not going to teach you C, it will tell you how to use the API though.
I tried the sound function (borland).
I'll try this too.
The borland code I posted, definitely works on WindowsXP --- if you have an internal speaker. You may need to take off the side of your case and get in a quiet room to hear it though. It is quite soft, if you have one of the modern type of speakers (the 1/2 inch around type).
My compiler (dev Cpp) doesn't recogonize the "DWORD"..
Code:#include <windows.h> #include <winbase.h> BOOL WINAPI Beep( __in DWORD dwFreq, __in DWORD dwDuration ); int main() { sound(100); delay(2000); nosound(); getchar(); return 0; }
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Did you mean to have two spaces before DWORD, or just one?Code:__in DWORD dwFreq, __in DWORD dwDuration
certainly works on XP (I just tested it) when compiled with gcc-mingw 3.4.2.Code:#include <windows.h> int main() { Beep(1000, 500); return 0; }
If that makes no sound when compiled with dev-c++ using gcc, then you haven't got a speaker inside your PC, or it's not connected correct (or something is broken in some other way).
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
ok.
Humm "sound" "delay" and "no sound" doesn't work at all,I think they need "dos.h" and to be compiled with borland only.
Anyway I tried this one:
No errors or warnnings but I didn't hear any sound ):Code:#include <windows.h> int main() { int i; for (i=0;i<100000;i++) beep(i*10,200); getchar(); return 0; }
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Both of them can make only silence.
I feel so stupid "><
Have you tried to compile my code with your compiler?
No, but aside from Beep instead of beep, I don't see anything wrong with it. I'm not going to subject my colleagues with an incrementally increasing frequncy from around 20Hz to 1MHz for several minutes either.
The code I posted definitely does work on XP. But I suspect the problem is that your PC doesn't have a speaker.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
lol
I don't expect you, me or anyone else to wait till the programm ends.
When I am using Beep, where should the sound be heard from?
From inside the comp' speakers or from my regular speakers?
Inside the computer.