親クラス内で静的クラスを宣言して初期化しようとしていますが、あらゆる種類のエラーが発生しているようです。
/* MainWindow.h */
class MainWindow
{
private:
static DWORD WINAPI threadproc(void* param);
static MainWindow *hWin;
};
/* MainWindow.cpp */
#include "MainWindow.h"
void MainWindow::on_pushButton_clicked()
{
HANDLE hThread = CreateThread(NULL, NULL, threadproc, (void*) this, NULL, NULL);
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
}
DWORD WINAPI MainWindow::threadproc(void* param)
{
hWin = (MainWindow*) param;
//Be able to access stuff like hWin->run();
return 0;
}
MainWindow::hWin = (MainWindow*) param;
などを使用してみMainWindow::hWin = new MainWindow((MainWindow*) param));
ましたが、どれも機能していないようです。これを行う適切な方法は何ですか?この件に関して誰かが推奨するリソースはありますか?私はclass
数日間問題に悩まされており、非常にイライラしています.