Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Multithreading 为什么我的VS表单在其他线程密集工作时没有检测到按钮点击事件? 我在VS C++ 2010 Express中创建了一个按钮。我还启动了另外三个线程,用于更新其他控件,包括3个图表: Graphs_Form::Graphs_Form(void) { InitializeComponent(); TopMost = true; myForm = this; fastTime = 10; //TODO: Add the constructor code here CreateThread(NULL, 0, thread_writeDisplay, 0 , 0, 0); CreateThread(NULL, 0, thread_runProgrammer, 0 , 0, 0); CreateThread(NULL, 0, thread_simulateTemps, 0 , 0, 0); }_Multithreading_Forms_Visual Studio 2010_Events_C++ Cli - Fatal编程技术网

Multithreading 为什么我的VS表单在其他线程密集工作时没有检测到按钮点击事件? 我在VS C++ 2010 Express中创建了一个按钮。我还启动了另外三个线程,用于更新其他控件,包括3个图表: Graphs_Form::Graphs_Form(void) { InitializeComponent(); TopMost = true; myForm = this; fastTime = 10; //TODO: Add the constructor code here CreateThread(NULL, 0, thread_writeDisplay, 0 , 0, 0); CreateThread(NULL, 0, thread_runProgrammer, 0 , 0, 0); CreateThread(NULL, 0, thread_simulateTemps, 0 , 0, 0); }

Multithreading 为什么我的VS表单在其他线程密集工作时没有检测到按钮点击事件? 我在VS C++ 2010 Express中创建了一个按钮。我还启动了另外三个线程,用于更新其他控件,包括3个图表: Graphs_Form::Graphs_Form(void) { InitializeComponent(); TopMost = true; myForm = this; fastTime = 10; //TODO: Add the constructor code here CreateThread(NULL, 0, thread_writeDisplay, 0 , 0, 0); CreateThread(NULL, 0, thread_runProgrammer, 0 , 0, 0); CreateThread(NULL, 0, thread_simulateTemps, 0 , 0, 0); },multithreading,forms,visual-studio-2010,events,c++-cli,Multithreading,Forms,Visual Studio 2010,Events,C++ Cli,根据以下指南,通过委托方法更新表单控件: delegate System::Void simulateTempsDelegate(); public: System::Void updateSimulateTemps() { simulateTempsDelegate^ action = gcnew simulateTempsDelegate(this, &Graphs_Form::simulateTemps); this->BeginInvoke(action); }

根据以下指南,通过委托方法更新表单控件:

delegate System::Void simulateTempsDelegate();

public: System::Void updateSimulateTemps() {
    simulateTempsDelegate^ action = gcnew simulateTempsDelegate(this, &Graphs_Form::simulateTemps);
this->BeginInvoke(action);
}
我的线程都这样调用代理:

DWORD WINAPI thread_simulateTemps(LPVOID lpParameter) {
    while (true) {
    Sleep(6000/fastTime); // 6 sec intervals            
    Graphs_Form::myForm->updateSimulateTemps();
    }
    return 0;
}
在我减少这些线程的睡眠时间之前,这些都可以正常工作。然后表单不再获得按钮单击事件。 有没有办法让我的表单不断检测按钮点击