Click here to Skip to main content
15,910,980 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Non Blocking message Box Pin
Randor 6-Sep-09 21:49
professional Randor 6-Sep-09 21:49 
QuestionHow Could we make a field or fields of database primary key for that database using Dao Database? Pin
A&Ms6-Sep-09 16:42
A&Ms6-Sep-09 16:42 
AnswerRe: How Could we make a field or fields of database primary key for that database using Dao Database? Pin
Stuart Dootson6-Sep-09 20:21
professionalStuart Dootson6-Sep-09 20:21 
QuestionModal Dialogs HELP!!! Pin
sixstorm6-Sep-09 15:22
sixstorm6-Sep-09 15:22 
AnswerRe: Modal Dialogs HELP!!! Pin
Iain Clarke, Warrior Programmer6-Sep-09 21:52
Iain Clarke, Warrior Programmer6-Sep-09 21:52 
GeneralRe: Modal Dialogs HELP!!! Pin
sixstorm7-Sep-09 6:34
sixstorm7-Sep-09 6:34 
AnswerRe: Modal Dialogs HELP!!! Pin
sixstorm7-Sep-09 8:08
sixstorm7-Sep-09 8:08 
QuestionActivating the PC's speaker using C++ for until I will need to stop - how ? (Beep, thread, and more)... Pin
amitalonm6-Sep-09 11:01
amitalonm6-Sep-09 11:01 
Hi,

I am trying to write a small application, using Visual C++.

In the application's GUI, among other things, there will be 2 buttons:
First button should turn the PC's internal speaker ON.
Second button should turn the PC's internal speaker OFF.

The GUI will have to be functional during all times.
I see that in order to use the PC's internal speaker I need to use the Beep(int tone, int duration) function. (or is there any other way ???)

The problem is that Beep function will play sound and stop the code's execution until duration mSec will be over.
This is not good to me, as I will need the program to continue do other things in the background and I will need it to response to the OFF button as well.

Using a flag to repeat the short Beeps again and again in a loop produces a glitch in the sound, every time that the Beep is executed (looped) again, so this is not elegant solution that I wold like to use.

The solution that I came to is:
ON button will start a thread, that will Beep endlessly.
OFF button will Beep for 1 mSec, and this way will terminate sound that the Beep from the BeepThread started.

Note that the Beep's thread called from ON button will never finish execution as it will be stack in it's Beep() line that has endless time as parameter.

The problem in my solution is that even if the sound stops, the BeepThread that was started will never end, and pressing several times on the on/off buttons will produce several BeepThreads.

Killing a thread from the outside is not recommended as well.

Any ideas on how to deal with this issue ?
I am open to change the whole way of my solution.

Thanks.
AnswerRe: Activating the PC's speaker using C++ for until I will need to stop - how ? (Beep, thread, and more)... Pin
Saurabh.Garg6-Sep-09 21:24
Saurabh.Garg6-Sep-09 21:24 
GeneralRe: Activating the PC's speaker using C++ for until I will need to stop - how ? (Beep, thread, and more)... Pin
amitalonm7-Sep-09 13:08
amitalonm7-Sep-09 13:08 
QuestionRe: Activating the PC's speaker using C++ for until I will need to stop - how ? (Beep, thread, and more)... Pin
amitalonm8-Sep-09 0:00
amitalonm8-Sep-09 0:00 
QuestionThe dll of IDB_VIEW_SMALL_COLOR Pin
Joel Holdsworth6-Sep-09 6:59
Joel Holdsworth6-Sep-09 6:59 
Questionis there a way to read message from the local port Pin
rj47566-Sep-09 3:59
rj47566-Sep-09 3:59 
AnswerRe: is there a way to read message from the local port Pin
Iain Clarke, Warrior Programmer6-Sep-09 9:03
Iain Clarke, Warrior Programmer6-Sep-09 9:03 
Question« Precompiled header file error » Pin
bzsolt916-Sep-09 2:21
bzsolt916-Sep-09 2:21 
QuestionRe: « Precompiled header file error » Pin
Rajesh R Subramanian6-Sep-09 3:47
professionalRajesh R Subramanian6-Sep-09 3:47 
QuestionQuickBooks simple questions Pin
John Developer5-Sep-09 23:29
John Developer5-Sep-09 23:29 
AnswerRe: QuickBooks simple questions Pin
Luc Pattyn6-Sep-09 1:08
sitebuilderLuc Pattyn6-Sep-09 1:08 
QuestionODS_HOTLIGHT not work Pin
thanhvinh09065-Sep-09 21:49
thanhvinh09065-Sep-09 21:49 
AnswerRe: ODS_HOTLIGHT not work Pin
Code-o-mat5-Sep-09 23:43
Code-o-mat5-Sep-09 23:43 
GeneralRe: ODS_HOTLIGHT not work Pin
thanhvinh09066-Sep-09 3:06
thanhvinh09066-Sep-09 3:06 
GeneralRe: ODS_HOTLIGHT not work Pin
Code-o-mat6-Sep-09 10:08
Code-o-mat6-Sep-09 10:08 
AnswerRe: ODS_HOTLIGHT not work Pin
Iain Clarke, Warrior Programmer6-Sep-09 9:16
Iain Clarke, Warrior Programmer6-Sep-09 9:16 
QuestionLabel adresses in inline assembly Pin
Remco Hoogenboezem5-Sep-09 11:21
Remco Hoogenboezem5-Sep-09 11:21 
AnswerRe: Label adresses in inline assembly Pin
Stuart Dootson5-Sep-09 13:46
professionalStuart Dootson5-Sep-09 13:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.