Click here to Skip to main content
15,903,012 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: linking two projects Pin
valli_guru6-Aug-07 18:30
valli_guru6-Aug-07 18:30 
GeneralRe: linking two projects Pin
User 5838526-Aug-07 18:34
User 5838526-Aug-07 18:34 
GeneralRe: linking two projects Pin
valli_guru6-Aug-07 18:50
valli_guru6-Aug-07 18:50 
GeneralRe: linking two projects Pin
User 5838526-Aug-07 18:57
User 5838526-Aug-07 18:57 
GeneralRe: linking two projects Pin
valli_guru6-Aug-07 19:23
valli_guru6-Aug-07 19:23 
GeneralRe: linking two projects Pin
User 5838526-Aug-07 19:26
User 5838526-Aug-07 19:26 
GeneralRe: linking two projects Pin
valli_guru6-Aug-07 19:40
valli_guru6-Aug-07 19:40 
QuestionGeneral Question Regarding real-time control Pin
alberthyc6-Aug-07 17:24
alberthyc6-Aug-07 17:24 
hi, i've been posting posts asking around questions regarding multithreading, and however my multithreading code never worked, so i'm thinking some other approach.

The problem i having is:
I need to create a MFC dialog with bunch of slider controls, the position of each slider will be stored into a data array.
So if i have 20 sliders, i'll have a array of 20 elements storing the postion of each slider. the data of the array will be transfered to a hardware and outputted.
I want this output to be continuous and can be changed real time. so if changed a slider position and output will be changed correspondingly.

i created a worker thread.
the thread function is:
UINT Start(...){
while(//some condition){
....
GetData();//this is the function store the position into data array
OutputData(Data)//output through hardware
}}

GetData(){
for(int i=0,i<20,i++){
Data[i]=Slider[i].GetPos()
}


there's a problem with this approach which is that my worker thread implicitly query the GUI object which is slider through GetData() function, which cause my program to enter a deadlock and the thread can't be terminated properly.

If I put the Getdata() in the main dialog thread, i could use the CEvent to create some communication between the thread, however, that would require me a loop since the data has to be continously output.
I haven't try this method yet, but i'm afraid the loop will cause the program to freeze.

I have another idea which doesn't involve the GetData()

CMYDlg::OnCustomDrawSlider1(.....){
SuspendThread(...);
Data[0]=Slider[0].GetPos();
ResumeThread(...);
}

CMYDlg::OnCustomDrawSlider2(.....){
SuspendThread(...);
Data[1]=Slider[1].GetPos();
ResumeThread(...);
}

then in the thread function, there's no more GetData() and no accessing GUI object which should be safe, however, i'm not sure the effect of SuspendThread()and ResumeThread() on my worker thread, what if the OutputData() is running and the thread is suspended??

I know this is a long post and thx for the patience for reading it.
Could anyone give me some suggestions on my approach to this program?


AnswerRe: General Question Regarding real-time control Pin
Russell'7-Aug-07 2:08
Russell'7-Aug-07 2:08 
QuestionRe: General Question Regarding real-time control Pin
David Crow7-Aug-07 3:03
David Crow7-Aug-07 3:03 
QuestionQuestion regarding DirectX Pin
godspeed1236-Aug-07 15:23
godspeed1236-Aug-07 15:23 
AnswerRe: Question regarding DirectX Pin
Mark Salsbery6-Aug-07 15:40
Mark Salsbery6-Aug-07 15:40 
GeneralRe: Question regarding DirectX Pin
godspeed1237-Aug-07 4:49
godspeed1237-Aug-07 4:49 
GeneralRe: Question regarding DirectX Pin
Mark Salsbery7-Aug-07 5:04
Mark Salsbery7-Aug-07 5:04 
QuestionSetting CComboBox Height Pin
WayneK1006-Aug-07 12:41
WayneK1006-Aug-07 12:41 
AnswerRe: Setting CComboBox Height Pin
Mark Salsbery6-Aug-07 13:35
Mark Salsbery6-Aug-07 13:35 
GeneralRe: Setting CComboBox Height Pin
WayneK1006-Aug-07 14:06
WayneK1006-Aug-07 14:06 
GeneralRe: Setting CComboBox Height Pin
Mark Salsbery6-Aug-07 14:14
Mark Salsbery6-Aug-07 14:14 
AnswerRe: Setting CComboBox Height Pin
Anurag Gandhi6-Aug-07 20:18
professionalAnurag Gandhi6-Aug-07 20:18 
QuestionExtracting binary resources -- PNG and Bitmap Pin
Torus_XL6-Aug-07 9:37
Torus_XL6-Aug-07 9:37 
AnswerRe: Extracting binary resources -- PNG and Bitmap Pin
Mark Salsbery6-Aug-07 9:52
Mark Salsbery6-Aug-07 9:52 
GeneralRe: Extracting binary resources -- PNG and Bitmap Pin
Torus_XL6-Aug-07 10:10
Torus_XL6-Aug-07 10:10 
GeneralRe: Extracting binary resources -- PNG and Bitmap Pin
Mark Salsbery6-Aug-07 13:28
Mark Salsbery6-Aug-07 13:28 
GeneralRe: Extracting binary resources -- PNG and Bitmap Pin
Torus_XL7-Aug-07 8:10
Torus_XL7-Aug-07 8:10 
AnswerRe: Extracting binary resources -- PNG and Bitmap Pin
Torus_XL6-Aug-07 11:04
Torus_XL6-Aug-07 11:04 

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.