Beep not working.

Beep function not working (I do not have administrative access).
Also, I get an error of ERROR_MOD_NOT_FOUND.
Any reasons why?

1
2
3
4
5
6
7
8
9
10
#include <windows.h>
#include <cstdio>

int main(void)
{
	printf("Beeping!");
	printf("\nAny Beep errors?\n%d",Beep(250,1000)); // Returns 1, which means there is something up.
	printf("\nAny errors?\n%d",GetLastError()); // Returns 126 (Specific Module could not be found.)
	return(0);
}


Edit: Apparently, Beep returns 1 regardless of success (http://www.autoitscript.com/autoit3/docs/functions/Beep.htm).
Last edited on
I know this doesn't answer your question but this is what I have used.

1
2
3
4
5
6
7
8
9
10
11
12
13
void alarm()
{
     cout << "Sending SOS\n";
     printf("\a""\a""\a");
     Sleep (1000);
     printf("\a");
     Sleep (750);
     printf("\a");
     Sleep (750);
     printf("\a");
     Sleep (750);
     printf("\a""\a""\a");
}



Here's a link you can look at with a working Beep.

http://libraryofcprograms.blogspot.com/2013/05/time.html
Last edited on
@usandfriends
Your code works for me so I don't think that is the problem. Also MSDN lists the return value as zero on failure and non-zero on success, I'm not sure how accurate the link you posted is. From googling the error code it looks like it's mostly "thrown" when loading a library fails, maybe check the libs you use are valid?
They are newly updated, using Orwell Dev-Cpp 5.4.1 newest version as of Feb 2013.
Topic archived. No new replies allowed.