- 577 名前:デフォルトの名無しさん mailto:sage [2012/08/14(火) 04:34:54.96 ]
- たぶんやりたいのはこうだと思うんだけど、違うかな。
DWORD WINAPI proc(LPVOID param) { typedef void (*fp_t)(void); fp_t fp = reinterpret_cast<fp_t>(param); for(int i = 0; i < 10; ++i) { ::Sleep(1000); fp(); } return 0; } public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); IntPtr fp = Marshal::GetFunctionPointerForDelegate(gcnew MethodInvoker(this, &CppCli575::Form1::addText)); ::CreateThread(NULL, 8192, proc, static_cast<LPVOID>(fp), 0, NULL); } void addText() { if (textBox1->InvokeRequired) { textBox1->Invoke(gcnew MethodInvoker(this, &CppCli575::Form1::addText)); return; } textBox1->Text += "A"; }
|

|