HelpBeep

Posts 1–7 of 7 · Page 1 of 1
Beep
I'm making a windows form(c++/cli) and I need when user press start button its beep on a frquency and stop with a pause button so used a timer but dont ended right some suggestion?
Hello @KissU

Making a Hardware Beep would have a Good Effect, if you Use this Method

Code:
BOOL WINAPI Beep(
  _In_  DWORD dwFreq,
  _In_  DWORD dwDuration
);
So to use this Function, You'll need to use them Parameters.

Code:
Beep(200,450); //Will Produce a Hardware Beep with the Frequency of 200, and a Duration of 450ms
I'd also Suggest to Read up on the Basic's, it Really does Help alot.

Cheers
kJNR
I know the basics, but I need a function to beep async if I do Beep(100,10000); the world can explode and its only stops if app is killed or time is over.I need Beep until user press pause, so i tried a thread and doesn't worked.
Quote Originally Posted by KissU View Post
I know the basics, but I need a function to beep async if I do Beep(100,10000); the world can explode and its only stops if app is killed or time is over.I need Beep until user press pause, so i tried a thread and doesn't worked.
Make a new thread and within it use a simple loop that keeps going untill the user pressed something. The beep duration can be 30ms as this is the average time the user press a key.
Write a Simple Function, and play a Beep?
Thats Less than Basic Knowledge i'm Afraid.

:/ - Sorry, but i Dont really Spoonfeed, Dont it in the Past - therefor People learn't Nothing.
:/


Cheers,
kJNR
do something like that:

Code:
DWORD WINAPI beep(LPVOID)
{
    for(;;)
        Beep(100, 50);
}

INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, INT nShow)
{
    HANDLE hThread = CreateThread(NULL, 0, beep, NULL, 0, NULL);
    while (!GetAsyncKeyState(VK_F5)) Sleep(50);
    TerminateThread(hThread, 0);
    CloseHandle(hThread);
    return 0;
}
I give up can close thread.
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us