最近、スタック内のメモリは他のスレッドと共有されておらず、ヒープ内のメモリは他のスレッドと共有されていると聞きました。
私は通常行います:
HWND otherThreadHwnd;
DWORD commandId;
// initialize commandId and otherThreadHwnd
struct MyData {
int data1_;
long data2_;
void* chunk_;
};
int abc() {
MyData myData;
// initialize myData
SendMessage(otherThreadHwnd,commandId,&myData);
// read myData
}
これをしてもいいですか?